示例#1
0
        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);
        }
示例#2
0
        public override string[] GetAllRoles()
        {
            DataTable UserRoles = SecurityAdapters.RolesAdapter.GetRoleNames();

            return(Array.ConvertAll(IgrssCommon.GetColumnValues(UserRoles, "RoleName"),
                                    new Converter <object, string>(Convert.ToString)));
        }
示例#3
0
        public string[] GetAllRolesByOfficeType(Guid OfficeTypeId)
        {
            DataTable UserRoles = SecurityAdapters.RolesAdapter.GetRolesByOfficeType(OfficeTypeId);

            return(Array.ConvertAll(IgrssCommon.GetColumnValues(UserRoles, "RoleNAme"),
                                    new Converter <object, string>(Convert.ToString)));
        }
示例#4
0
        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)));
        }
示例#5
0
        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)));
        }
示例#6
0
    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();
    }
示例#7
0
        public string[] FindUsersInRole(Guid roleId, string usernameToMatch)
        {
            DataTable UsersInOfficeRole = SecurityAdapters.MembershipAdapter.GetUsersInOfficeRole(usernameToMatch, roleId);

            return((string[])IgrssCommon.GetColumnValues(UsersInOfficeRole, "Username"));
        }