| Line 55... |
Line 55... |
| 55 |
studentGroup = (GroupPrincipal)result;
|
55 |
studentGroup = (GroupPrincipal)result;
|
| 56 |
studentGroup.Members.Add(newUser);
|
56 |
studentGroup.Members.Add(newUser);
|
| 57 |
studentGroup.Save();
|
57 |
studentGroup.Save();
|
| 58 |
}
|
58 |
}
|
| 59 |
DebugText.appendText("Account " + username + " has been created");
|
59 |
DebugText.appendText("Account " + username + " has been created");
|
| - |
|
60 |
StatLogging.AccountsCreated += 1;
|
| 60 |
return true;
|
61 |
return true;
|
| 61 |
}
|
62 |
}
|
| 62 |
else
|
63 |
else
|
| 63 |
{
|
64 |
{
|
| 64 |
// local account already exists, return with error
|
65 |
// local account already exists, return with error
|
| Line 158... |
Line 159... |
| 158 |
// Adds NTFS permissions for the user
|
159 |
// Adds NTFS permissions for the user
|
| 159 |
dSecurity.AddAccessRule(new FileSystemAccessRule("\\" + username, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow));
|
160 |
dSecurity.AddAccessRule(new FileSystemAccessRule("\\" + username, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow));
|
| 160 |
dSecurity.AddAccessRule(new FileSystemAccessRule("\\" + username, FileSystemRights.FullControl, InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow));
|
161 |
dSecurity.AddAccessRule(new FileSystemAccessRule("\\" + username, FileSystemRights.FullControl, InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow));
|
| 161 |
Directory.CreateDirectory(Settings_Form.sharedFolderLocation + @"\" + username, dSecurity);
|
162 |
Directory.CreateDirectory(Settings_Form.sharedFolderLocation + @"\" + username, dSecurity);
|
| 162 |
DebugText.appendText("Shared folder for " + username + " has been created");
|
163 |
DebugText.appendText("Shared folder for " + username + " has been created");
|
| 163 |
return SetSharePermissions(username);
|
164 |
if (SetSharePermissions(username))
|
| - |
|
165 |
{
|
| - |
|
166 |
StatLogging.SharesCreated += 1;
|
| - |
|
167 |
return true;
|
| - |
|
168 |
}
|
| - |
|
169 |
else
|
| - |
|
170 |
return false;
|
| 164 |
}
|
171 |
}
|
| 165 |
catch (Exception e)
|
172 |
catch (Exception e)
|
| 166 |
{
|
173 |
{
|
| 167 |
//MessageBox.Show(e.ToString(), "Error");
|
174 |
//MessageBox.Show(e.ToString(), "Error");
|
| 168 |
DebugText.appendText(e.ToString());
|
175 |
DebugText.appendText(e.ToString());
|