void RefreshRolesForUserComboBox() { string[] roles = null; if (String.IsNullOrEmpty(UserToAssign) == false) { using (RoleManagerProxy roleManager = new RoleManagerProxy(ServiceAddress)) roles = roleManager.GetRolesForUser(ApplicationName, UserToAssign); } m_RolesForUserComboBox.RefreshComboBox(UserToAssign, roles); }
void OnRemoveUsersFromAllRoles(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to remove the user " + UserToAssign + " from all its roles?", "Credentials Manager", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (result == DialogResult.OK) { using (RoleManagerProxy roleManager = new RoleManagerProxy(ServiceAddress)) { string[] roles = roleManager.GetRolesForUser(ApplicationName, UserToAssign); if (roles.Length > 0) { roleManager.RemoveUserFromRoles(ApplicationName, UserToAssign, roles); RefreshRolesForUserComboBox(); RefreshUsersForRoleComboBox(); RefreshRolePageButtons(); } } } }
void RefreshRolesForUserComboBox() { string[] roles = null; if(String.IsNullOrEmpty(UserToAssign) == false) { using(RoleManagerProxy roleManager = new RoleManagerProxy(ServiceAddress)) roles = roleManager.GetRolesForUser(ApplicationName,UserToAssign); } m_RolesForUserComboBox.RefreshComboBox(UserToAssign,roles); }
void OnRemoveUsersFromAllRoles(object sender,EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to remove the user " + UserToAssign + " from all its roles?","Credentials Manager",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning); if(result == DialogResult.OK) { using(RoleManagerProxy roleManager = new RoleManagerProxy(ServiceAddress)) { string[] roles = roleManager.GetRolesForUser(ApplicationName,UserToAssign); if(roles.Length > 0) { roleManager.RemoveUserFromRoles(ApplicationName,UserToAssign,roles); RefreshRolesForUserComboBox(); RefreshUsersForRoleComboBox(); RefreshRolePageButtons(); } } } }