public override string[] GetAllRoles() { DataTable UserRoles = SecurityAdapters.RolesAdapter.GetRoleNames(); return(Array.ConvertAll(IgrssCommon.GetColumnValues(UserRoles, "RoleName"), new Converter <object, string>(Convert.ToString))); }
public bool DeleteRole(Guid RoleId, Guid OfficeTypeId, bool throwOnPopulatedRole) { try { string curUser = Thread.CurrentPrincipal.Identity.Name; DataTable OfficeDetails = SecurityAdapters.OfficesAdapter.GetOfficesByType(OfficeTypeId); if (throwOnPopulatedRole && (0 < OfficeDetails.Rows.Count)) { throw new ProviderException("Cannot delete a populated role."); } object[] OfficeIds = IgrssCommon.GetColumnValues(OfficeDetails, "OfficeId"); foreach (object OfficeId in OfficeIds) { SecurityAdapters.UsersInRoleAdapter.DeactivateUsersInOfficeRole(RoleId, (Guid)OfficeId, curUser, DateTime.Now); } if (0 < SecurityAdapters.RolesAdapter.DeactivateRoleById(RoleId, curUser, DateTime.Now)) { return(false); } } catch (Exception ex) { throw ex; } return(true); }
public string[] GetAllRolesByOfficeType(Guid OfficeTypeId) { DataTable UserRoles = SecurityAdapters.RolesAdapter.GetRolesByOfficeType(OfficeTypeId); return(Array.ConvertAll(IgrssCommon.GetColumnValues(UserRoles, "RoleNAme"), new Converter <object, string>(Convert.ToString))); }
public override string[] GetUsersInRole(string roleName) { Guid RoleId = (Guid)SecurityAdapters.RolesAdapter.GetRoleIdByName(roleName); DataTable UsersInRole = SecurityAdapters.MembershipAdapter.GetUsersInRoleById(RoleId); return(Array.ConvertAll(IgrssCommon.GetColumnValues(UsersInRole, "Username"), new Converter <object, string>(Convert.ToString))); }
public override string[] GetRolesForUser(string username) { Guid UserId = (Guid)SecurityAdapters.MembershipAdapter.GetUserId(username); DataTable UserRoles = SecurityAdapters.RolesAdapter.GetRolesByUserId(UserId); return(Array.ConvertAll(IgrssCommon.GetColumnValues(UserRoles, "RoleName"), new Converter <object, string>(Convert.ToString))); }
public string[] FindUsersInRole(Guid roleId, string usernameToMatch) { DataTable UsersInOfficeRole = SecurityAdapters.MembershipAdapter.GetUsersInOfficeRole(usernameToMatch, roleId); return((string[])IgrssCommon.GetColumnValues(UsersInOfficeRole, "Username")); }