private WindowsUser findWindowsUser(string username) { WindowsUserManager manager = new WindowsUserManager(ServerConfig.WindowsServerName); WindowsUser windowsUser = manager.Find(username); return(windowsUser); }
private WindowsUser findWindowsUser() { WindowsUserManager wuManager = new WindowsUserManager(ServerConfig.WindowsServerName); WindowsUser namedUser = wuManager.Find(iscBindUser); return(namedUser); }
public override IOSUserManager Create() { WindowsUserManager userManager = new WindowsUserManager(); _user.Flexibility = userManager.PowerOfUI(); return(userManager); }
private bool relativePathAndUserExists(SecurityTemplate st, DirectoryInfo websiteDirectory) { SecurityTemplateManager stm = CreateManager <SecurityTemplateManager>(); WindowsUserManager wum = new WindowsUserManager(ServerConfig.WindowsServerName); return(!stm.RelativePathExists(websiteDirectory, st.RelativePath) || (!wum.Exists(st.Username) && !st.UseIisIdentity)); }
private ServerStatusElement getIscBindSecurityStatus() { ServerStatusElement e = new ServerStatusElement(); e.Name = "ISC BIND security (" + ServerConfig.IscBindDirectory.FullName + ")"; DirectorySecurity security = ServerConfig.IscBindDirectory.GetAccessControl(); AuthorizationRuleCollection rules = security.GetAccessRules( true, false, typeof(SecurityIdentifier)); WindowsUserManager wuManager = new WindowsUserManager(ServerConfig.WindowsServerName); WindowsUser namedUser = wuManager.Find(iscBindUser); if (namedUser == null) { e.Value = "Windows user '" + iscBindUser + "' is missing"; e.Condition = ServerStatusCondition.Error; } else { var q = from r in rules.OfType <FileSystemAccessRule>() where r.IdentityReference == namedUser.Sid where r.AccessControlType == AccessControlType.Allow select r; if (q.Count() != 0) { if ((q.Single().FileSystemRights & FileSystemRights.Modify) == FileSystemRights.Modify) { e.Value = "User '" + iscBindUser + "' can modify"; e.Condition = ServerStatusCondition.Normal; } else { e.Value = "User '" + iscBindUser + "' cannot modify"; e.Condition = ServerStatusCondition.Error; } } else { e.Value = "User '" + iscBindUser + "' does not have any access"; e.Condition = ServerStatusCondition.Error; } if (e.Condition == ServerStatusCondition.Error) { // At this point, if the user exists but the security is wrong, it can be reset. e.ActionText = "Repair"; e.ActionCommand = "RepairBindSecurity"; } } return(e); }
private void createServiceAccount() { windowsUser = new WindowsUser( accountUserName, accountPassword, accountDisplayName, accountDescription, WindowsUserFlag.PasswordCannotChange | WindowsUserFlag.PasswordNeverExpires); WindowsUserManager manager = new WindowsUserManager(Environment.MachineName); manager.Create(windowsUser); manager.GrantLogonAsService(windowsUser); }
private bool removeServiceAccount() { bool result; try { WindowsUserManager manager = new WindowsUserManager(Environment.MachineName); if (manager.Exists(accountUserName)) { manager.Delete(accountUserName); } result = true; } catch (Exception ex) { result = false; DialogResult dr = MessageBox.Show( "Could not remove ISC BIND service account.\r\n\r\n" + ex.Message, "Remove service account", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning); switch (dr) { case DialogResult.Retry: removeServiceAccount(); break; case DialogResult.Ignore: result = true; break; } } return(result); }
void WebsiteManager_Load(object sender, EventArgs e) { wuManager = new WindowsUserManager(ServerConfig.WindowsServerName); dnsManager = CreateManager <IscBindManager>(); iisManager = new ServerManager(); }
public bool UserExists(string username) { WindowsUserManager wuManager = new WindowsUserManager(ServerConfig.WindowsServerName); return(wuManager.Exists(username)); }