Commit c9505b39d46078b2db92dfb41304cfbaeb5223ac

Authored by Emerson Piana Costa
1 parent 6ce63dd4
Exists in master

Corrigido para a ultima atualização utilizada em Guarapari

Showing 1 changed file with 10 additions and 43 deletions   Show diff stats
SetPermissions.hta
@@ -40,9 +40,8 @@ font-weight: bold; @@ -40,9 +40,8 @@ font-weight: bold;
40 </HEAD> 40 </HEAD>
41 41
42 <SCRIPT LANGUAGE="VBScript"> 42 <SCRIPT LANGUAGE="VBScript">
43 - Dim fso, oFile  
44 - 'Set fso = CreateObject("Scripting.FileSystemObject")  
45 - Set objFSO = CreateObject("Scripting.FileSystemObject") 43 + Dim fso, oFile
  44 + Set fso = CreateObject("Scripting.FileSystemObject")
46 Set objShell = CreateObject("WScript.Shell") 45 Set objShell = CreateObject("WScript.Shell")
47 46
48 Sub Window_Onload 47 Sub Window_Onload
@@ -87,44 +86,13 @@ font-weight: bold; @@ -87,44 +86,13 @@ font-weight: bold;
87 86
88 '<!--#######################[ Buttons Actions ]#######################--> 87 '<!--#######################[ Buttons Actions ]#######################-->
89 Sub TestScript 88 Sub TestScript
90 - strDirectory = "q:\"  
91 strServer = AvailableServer.Value 89 strServer = AvailableServer.Value
92 strGroup = GroupName.Value 90 strGroup = GroupName.Value
93 strPermission = right(strGroup,1) 91 strPermission = right(strGroup,1)
94 strPermission = replace(strPermission, "L", "RX") 92 strPermission = replace(strPermission, "L", "RX")
95 strPermission = ":" & strPermission 93 strPermission = ":" & strPermission
96 - 'MsgBox strPermission  
97 strFolder = mid(strGroup, 7, len(strGroup) - 8) 94 strFolder = mid(strGroup, 7, len(strGroup) - 8)
98 strFolder = replace(strFolder, "-", "\") 95 strFolder = replace(strFolder, "-", "\")
99 - '########separa "-" dos diretorios  
100 - 'WrdArray = split(strFolder,"-")  
101 - 'MsgBox WrdArray  
102 - 'For nF = 0 To UBound(WrdArray)  
103 - ' strDirectory = "q:\AD"  
104 - ' MsgBox WrdArray(nF)  
105 - 'Next  
106 - 'fim ########  
107 -  
108 - 'cria pasta############  
109 - MsgBox strDirectory&strFolder  
110 -  
111 - If objFSO.FolderExists(strDirectory&strFolder) Then  
112 - Set objFolder = objFSO.GetFolder(strDirectory&strFolder)  
113 - MsgBox strFolder & " already created "  
114 - Else  
115 - Set objFolder = objFSO.CreateFolder(strDirectory&strFolder)  
116 - MsgBox "Just created " & strFolder  
117 - End If  
118 -  
119 - If err.number = vbEmpty then  
120 - Set objShell = CreateObject("WScript.Shell")  
121 - objShell.run ("Explorer" &" " & strDirectory&strFolder & "\" )  
122 - Else  
123 - MsgBox "VBScript Error: " & err.number  
124 - End If  
125 - '##################  
126 -  
127 -  
128 96
129 MsgBox "You Selected:" & VBCRLF & _ 97 MsgBox "You Selected:" & VBCRLF & _
130 "Server: " & strServer & VBCRLF & _ 98 "Server: " & strServer & VBCRLF & _
@@ -134,7 +102,6 @@ font-weight: bold; @@ -134,7 +102,6 @@ font-weight: bold;
134 102
135 sCMD=("%COMSPEC% /C Echo Y| icacls " & strServer & "\" & strFolder & " /t /c /grant " & strGroup & strPermission) 103 sCMD=("%COMSPEC% /C Echo Y| icacls " & strServer & "\" & strFolder & " /t /c /grant " & strGroup & strPermission)
136 MsgBox sCMD, 64,"Debug Command Box" 104 MsgBox sCMD, 64,"Debug Command Box"
137 -  
138 End Sub 'TestScript 105 End Sub 'TestScript
139 106
140 Sub EditServer 107 Sub EditServer
@@ -209,18 +176,18 @@ font-weight: bold; @@ -209,18 +176,18 @@ font-weight: bold;
209 Set objFSO = CreateObject("Scripting.FileSystemObject") 176 Set objFSO = CreateObject("Scripting.FileSystemObject")
210 If objFSO.FolderExists(strServer & "\" & strShare & "\" & strFolder) Then 177 If objFSO.FolderExists(strServer & "\" & strShare & "\" & strFolder) Then
211 178
212 - ' definição de permissoes. 179 + ' definição de permissoes.
213 'Notes 180 'Notes
214 - '/t aplicar as permissões nas subpastas e arquivos a partir desta pasta 181 + '/t aplicar as permissões nas subpastas e arquivos a partir desta pasta
215 '/c continua o script mesmo com erro 182 '/c continua o script mesmo com erro
216 - '/grant Administrators (Seta permissões para Administrators) 183 + '/grant Administrators (Seta permissões para Administrators)
217 ':F (para acesso full), :RX (Ler e Executar), :M (Modificar), :WD (Adiciona arquivos), :AD (Adiciona diretorios) 184 ':F (para acesso full), :RX (Ler e Executar), :M (Modificar), :WD (Adiciona arquivos), :AD (Adiciona diretorios)
218 '(OI) pasta e arquivos 185 '(OI) pasta e arquivos
219 '(CI) pasta e subpastas 186 '(CI) pasta e subpastas
220 '(IO) propaga apenas aos filhos 187 '(IO) propaga apenas aos filhos
221 - '(NP) não propaga aos filhos 188 + '(NP) não propaga aos filhos
222 189
223 - UpdateGroup 'Atualiza descrição do grupo 190 + UpdateGroup 'Atualiza descrição do grupo
224 191
225 ' define permissoes para a pasta base. 192 ' define permissoes para a pasta base.
226 If strPermission = "F" Then 193 If strPermission = "F" Then
@@ -246,7 +213,7 @@ font-weight: bold; @@ -246,7 +213,7 @@ font-weight: bold;
246 'MsgBox "%COMSPEC% /C Echo Y| icacls " & strServer & "\" & strShare & "\" & strFolder & " /c /grant " & strGroup & ":" & strPermission , 48, "Attention" 213 'MsgBox "%COMSPEC% /C Echo Y| icacls " & strServer & "\" & strShare & "\" & strFolder & " /c /grant " & strGroup & ":" & strPermission , 48, "Attention"
247 End If 'intRunError <> 0 214 End If 'intRunError <> 0
248 215
249 - ' define permissoes de leitura à pastas anteriores à pasta base. 216 + ' define permissoes de leitura à pastas anteriores à pasta base.
250 do while InStr(strFolder,"\") > 0 217 do while InStr(strFolder,"\") > 0
251 'MsgBox "Folder " & VBCRLF & strServer & "\" & strShare & "\" & strFolder & VBCRLF & "possui pasta anterior" , 48, "Attention" 218 'MsgBox "Folder " & VBCRLF & strServer & "\" & strShare & "\" & strFolder & VBCRLF & "possui pasta anterior" , 48, "Attention"
252 strBeforeFolder = strBeforeFolder & mid(strFolder,1,InStr(strFolder,"\")) 219 strBeforeFolder = strBeforeFolder & mid(strFolder,1,InStr(strFolder,"\"))
@@ -276,13 +243,13 @@ font-weight: bold; @@ -276,13 +243,13 @@ font-weight: bold;
276 }>"> 243 }>">
277 <a name="Top"></a> 244 <a name="Top"></a>
278 <CENTER> 245 <CENTER>
279 - <p>O nome do grupo deverá estar cadastrado no AD, e deverá existir o caminho de acordo com o nome do grupo.</p> 246 + <p>O nome do grupo deverá estar cadastrado no AD, e deverá existir o caminho de acordo com o nome do grupo.</p>
280 <table border="0" cellpadding="0" cellspacing="0"><font size="2" color="black" face="Arial"> 247 <table border="0" cellpadding="0" cellspacing="0"><font size="2" color="black" face="Arial">
281 <tr> 248 <tr>
282 <td height="30"><p align="right">Server</p></td> 249 <td height="30"><p align="right">Server</p></td>
283 <td height="45">&nbsp;&nbsp; <select size="1" name="AvailableServer" size="30"></select>&nbsp;&nbsp;<input type="button" value="Edit" onclick="EditServer">&nbsp;<input type="button" value="Reload" onclick="ReloadServer"></td></tr> 250 <td height="45">&nbsp;&nbsp; <select size="1" name="AvailableServer" size="30"></select>&nbsp;&nbsp;<input type="button" value="Edit" onclick="EditServer">&nbsp;<input type="button" value="Reload" onclick="ReloadServer"></td></tr>
284 <tr> 251 <tr>
285 - <td height="30"><p align="right">Nome do grupo</p></td> 252 + <td height="30"><p align="right">Group Name</p></td>
286 <td height="45">&nbsp;&nbsp; <input type="text" name="GroupName" size="45"></td></tr> 253 <td height="45">&nbsp;&nbsp; <input type="text" name="GroupName" size="45"></td></tr>
287 </table><BR> 254 </table><BR>
288 255