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 override string[] GetAllRoles() { DataTable UserRoles = SecurityAdapters.RolesAdapter.GetRoleNames(); return(Array.ConvertAll(IgrssCommon.GetColumnValues(UserRoles, "RoleName"), new Converter <object, string>(Convert.ToString))); }
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))); }
void Application_Start(object sender, EventArgs e) { // Code that runs on application startup RJS.Web.WebControl.PopCalendar.JavaScriptCustomPath = "~/App_Scripts/PopCalendar"; IgrssCommon.SetConnectionString("IGRSS_FINALConnectionString", ConfigurationManager.ConnectionStrings["IGRSS_FINALConnectionString"].ConnectionString); IgrssCommon.SetConnectionString("IGRSS_DEVConnectionString", ConfigurationManager.ConnectionStrings["WorkflowConnection"].ConnectionString); MembershipCreateStatus CreateUser = new MembershipCreateStatus(); Membership.CreateUser("admin", "admin", "*****@*****.**", "admin", "admin", true, out CreateUser); ProfileCommon UserProfile = (ProfileCommon)ProfileCommon.Create("admin"); XmlDocument xmlDoc = new XmlDocument(); string XmlFilePath = "~/XMLFile.xml"; xmlDoc.Load(Server.MapPath(XmlFilePath)); UserProfile.Permissions.MenuItems = xmlDoc.OuterXml; UserProfile.Save(); }
public string[] FindUsersInRole(Guid roleId, string usernameToMatch) { DataTable UsersInOfficeRole = SecurityAdapters.MembershipAdapter.GetUsersInOfficeRole(usernameToMatch, roleId); return((string[])IgrssCommon.GetColumnValues(UsersInOfficeRole, "Username")); }