public static int QuickAddUser(string loginID, string roleCode, string defaultPassword, string defaultEmail)
        {
            try
            {
                Membership.CreateUser(loginID, defaultPassword, loginID + defaultEmail);

                SystemUserWrapper user = SystemUserWrapper.FindByLoginID(loginID);

                user.UserName = loginID;

                SystemUserWrapper.Update(user);

                SystemRoleWrapper clientRole = SystemRoleWrapper.GetRoleByCode(roleCode);

                SystemUserWrapper.PatchAssignUserRoles(user, new List <string> {
                    clientRole.RoleID.ToString()
                });

                return(user.UserID);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(-1);
            }
        }
Exemple #2
0
        public static List <SystemUserWrapper> GetUserByUserLoginId(string userLoginId)
        {
            SystemUserWrapper systemUser = SystemUserWrapper.FindByLoginID(userLoginId);

            SystemRoleWrapper systemRoleWrapper = SystemUserWrapper.GetUserMaxRoleTypeRole(systemUser);



            List <SystemUserWrapper> userWrappers = new List <SystemUserWrapper>();



            if (userLoginId == SystemUserWrapper.DEV_USER_ID || userLoginId == SystemUserWrapper.SYS_USER_ID)
            {
                userWrappers = SystemUserWrapper.FindAll();
            }


            else
            if (systemRoleWrapper.RoleType != "5")
            {
                userWrappers = SystemUserWrapper.ConvertToWrapperList(businessProxy.GetUserByRole(systemRoleWrapper.Entity));
            }
            else
            {
                userWrappers.Add(systemUser);
            }


            return(userWrappers);
        }
Exemple #3
0
        public static void CreateRole(string roleName)
        {
            var role = new SystemRoleWrapper {
                RoleName = roleName, RoleDescription = "", RoleIsSystemRole = false
            };

            SaveOrUpdate(role);
        }
Exemple #4
0
        public static List <SystemApplicationWrapper> GetRoleAssignedApplications(SystemRoleWrapper role)
        {
            if (role == null)
            {
                throw new ArgumentNullException("role");
            }

            return(SystemApplicationWrapper.ConvertToWrapperList(businessProxy.GetRoleAssignedApplications(role.entity)));
        }
Exemple #5
0
        public static void PatchAssignRoleMenusInApplication(SystemRoleWrapper role, int applicationID, string[] assignedMenuIDS)
        {
            SystemApplicationWrapper applicationWrapper = SystemApplicationWrapper.FindById(applicationID);

            if (role != null && applicationWrapper != null)
            {
                businessProxy.PatchAssignRoleMenusInApplication(role.entity, applicationWrapper.entity, assignedMenuIDS);
            }
        }
 /// <summary>
 /// 获取角色分配的所有菜单
 /// </summary>
 /// <param name="role">角色对象</param>
 /// <returns></returns>
 public static List <string> GetRoleAssignedMenuIDs(SystemRoleWrapper role)
 {
     if (role != null)
     {
         return(businessProxy.GetRoleAssignedMenuIDs(role.Entity));
     }
     else
     {
         throw new ArgumentNullException("role");
     }
 }
        public static List <SystemRoleWrapper> GetUserWrappersAssignedRoleIDs(SystemUserWrapper userWrapper)
        {
            if (userWrapper == null)
            {
                throw new ArgumentNullException("userWrapper");
            }

            List <SystemRoleEntity> assignedRoles = businessProxy.GetUserAssignedRoleByUser(userWrapper.entity);

            return(SystemRoleWrapper.ConvertToWrapperList(assignedRoles));
        }
Exemple #8
0
        public static void PatchAssignRolePermissions(SystemRoleWrapper role, List <string> assignedPermissionIDs)
        {
            if (role == null)
            {
                throw new ArgumentNullException("role");
            }
            if (assignedPermissionIDs == null)
            {
                throw new ArgumentNullException("assignedPermissionIDs");
            }

            businessProxy.PatchAssignRolePermissions(role.entity, assignedPermissionIDs);
        }
        public static List <SystemApplicationWrapper> GetUserAvaiableApplicationsNotAssigned(SystemUserWrapper currentLoginUser, int roleID)
        {
            List <SystemApplicationWrapper> allAplications = GetUserAvaiableApplications(currentLoginUser);

            SystemRoleWrapper systemRoleWrapper = SystemRoleWrapper.FindById(roleID);

            List <SystemApplicationWrapper> assignedApplications = SystemRoleWrapper.GetRoleAssignedApplications(systemRoleWrapper);

            foreach (SystemApplicationWrapper assignedApplication in assignedApplications)
            {
                int appID = assignedApplication.SystemApplicationID;

                allAplications.RemoveAll(p => (p.SystemApplicationID == appID));
            }

            return(allAplications);
        }
Exemple #10
0
        public static List <string> GetRoleAssignedApplicationIDs(SystemRoleWrapper role)
        {
            if (role == null)
            {
                throw new ArgumentNullException("role");
            }

            List <string> assignedApplicationIDs = new List <string>();

            List <SystemApplicationEntity> list = businessProxy.GetRoleAssignedApplications(role.entity);

            foreach (SystemApplicationEntity applicationEntity in list)
            {
                assignedApplicationIDs.Add(applicationEntity.SystemApplicationID.ToString());
            }

            return(assignedApplicationIDs);
        }
Exemple #11
0
        public static List <string> GetRoleAssignedPermissions(SystemRoleWrapper role)
        {
            if (role == null)
            {
                throw new ArgumentNullException("role");
            }

            List <string> assignedPermissions = new List <string>();

            List <SystemPrivilegeEntity> list = businessProxy.GetRoleAssignedPermissions(role.entity);

            foreach (SystemPrivilegeEntity systemPrivilegeEntity in list)
            {
                assignedPermissions.Add(systemPrivilegeEntity.PrivilegeID.ToString());
            }

            return(assignedPermissions);
        }
Exemple #12
0
        protected void btnSaveSystemRole_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SystemRoleWrapper obj = new SystemRoleWrapper();
                obj.RoleName = this.txtRoleName.Text.Trim();
                obj.RoleCode = this.txtRoleCode.Text.Trim();
                obj.RoleDescription = this.txtRoleDescription.Text.Trim();
                obj.RoleIsSystemRole = this.chkRoleIsSystemRole.Checked;

                SystemRoleWrapper.Save(obj);

                winSystemRoleAdd.Hide();

            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess = false;
                ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message);
            }
        }
Exemple #13
0
        public static List <SystemPrivilegeInRolesWrapper> GetRoleAssignedPrivilegesInRole(SystemRoleWrapper role)
        {
            if (role == null)
            {
                throw new ArgumentNullException("role");
            }

            return(SystemPrivilegeInRolesWrapper.ConvertToWrapperList(businessProxy.GetRoleAssignedPrivilegesInRole(role.entity)));
        }
 public static SystemRoleWrapper GetUserDefaultRoleByUserID(int userID)
 {
     return(SystemRoleWrapper.ConvertEntityToWrapper(businessProxy.GetUserDefaultRoleByUserID(userID)));
 }
 public static SystemRoleWrapper GetUserMinRoleTypeRole(SystemUserWrapper userWrapper)
 {
     return(SystemRoleWrapper.ConvertEntityToWrapper(businessProxy.GetUserMinRoleTypeRole(userWrapper.entity)));
 }
Exemple #16
0
 public static List<SystemUserRoleRelationWrapper> FindAllByRoleID(SystemRoleWrapper roleID)
 {
     return ConvertToWrapperList(businessProxy.FindAllByRoleID(roleID.entity));
 }
Exemple #17
0
        public static List<SystemApplicationWrapper> GetRoleAssignedApplications(SystemRoleWrapper role)
        {
            if (role == null)
                throw new ArgumentNullException("role");

            return SystemApplicationWrapper.ConvertToWrapperList(businessProxy.GetRoleAssignedApplications(role.entity));
        }
Exemple #18
0
 public static void SaveOrUpdate(SystemRoleWrapper obj)
 {
     businessProxy.SaveOrUpdate(obj.entity);
 }
Exemple #19
0
 public static void Refresh(SystemRoleWrapper instance)
 {
     businessProxy.Refresh(instance.entity);
 }
Exemple #20
0
 public static void Save(SystemRoleWrapper obj)
 {
     businessProxy.Save(obj.entity);
 }
Exemple #21
0
 public static void CreateRole(string roleName)
 {
     var role = new SystemRoleWrapper { RoleName = roleName, RoleDescription = "", RoleIsSystemRole = false };
     SaveOrUpdate(role);
 }
Exemple #22
0
        public static void PatchAssignRolePermissions(SystemRoleWrapper role, List<string> assignedPermissionIDs)
        {
            if (role == null)
                throw new ArgumentNullException("role");
            if (assignedPermissionIDs == null)
                throw new ArgumentNullException("assignedPermissionIDs");

            businessProxy.PatchAssignRolePermissions(role.entity, assignedPermissionIDs);
        }
Exemple #23
0
 public static List<SystemUserRoleRelationWrapper> FindAllByOrderByAndFilterAndRoleID(string orderByColumnName, bool isDesc,   SystemRoleWrapper roleID,  PageQueryParams pageQueryParams)
 {
     return ConvertToWrapperList(businessProxy.FindAllByOrderByAndFilterAndRoleID(orderByColumnName, isDesc,   roleID.entity, pageQueryParams));
 }
Exemple #24
0
        public static void PatchAssignRoleMenusInApplication(SystemRoleWrapper role, int applicationID, string[] assignedMenuIDS)
        {
            SystemApplicationWrapper applicationWrapper = SystemApplicationWrapper.FindById(applicationID);

            if (role != null && applicationWrapper != null)
            {
                businessProxy.PatchAssignRoleMenusInApplication(role.entity, applicationWrapper.entity, assignedMenuIDS);
            }
        }
Exemple #25
0
        public static List<SystemPrivilegeInRolesWrapper> GetRoleAssignedPrivilegesInRole(SystemRoleWrapper role)
        {
            if (role == null)
                throw new ArgumentNullException("role");

            return SystemPrivilegeInRolesWrapper.ConvertToWrapperList(businessProxy.GetRoleAssignedPrivilegesInRole(role.entity));
        }
Exemple #26
0
        public static List<string> GetRoleAssignedPermissions(SystemRoleWrapper role)
        {
            if (role == null)
                throw new ArgumentNullException("role");

            List<string> assignedPermissions = new List<string>();

            List<SystemPrivilegeEntity> list = businessProxy.GetRoleAssignedPermissions(role.entity);

            foreach (SystemPrivilegeEntity systemPrivilegeEntity in list)
            {
                assignedPermissions.Add(systemPrivilegeEntity.PrivilegeID.ToString());
            }

            return assignedPermissions;
        }
Exemple #27
0
 public static SystemPrivilegeInRolesWrapper GetRelationByRoleAndPrivilege(SystemRoleWrapper systemRoleWrapper, SystemPrivilegeWrapper systemPrivilegeWrapper)
 {
     return(ConvertEntityToWrapper(businessProxy.GetRelationByRoleAndPrivilege(systemRoleWrapper.entity, systemPrivilegeWrapper.entity)));
 }
Exemple #28
0
 public static void Update(SystemRoleWrapper obj)
 {
     businessProxy.Update(obj.entity);
 }
 public static List <SystemPrivilegeInRolesWrapper> FindAllByRoleID(SystemRoleWrapper roleID)
 {
     return(ConvertToWrapperList(businessProxy.FindAllByRoleID(roleID.Entity)));
 }
Exemple #30
0
 public static void Delete(SystemRoleWrapper instance)
 {
     businessProxy.Delete(instance.entity);
 }
Exemple #31
0
 public static void Delete(SystemRoleWrapper instance)
 {
     businessProxy.Delete(instance.entity);
 }
Exemple #32
0
        public static List<string> GetRoleAssignedApplicationIDs(SystemRoleWrapper role)
        {
            if (role == null)
                throw new ArgumentNullException("role");

            List<string> assignedApplicationIDs = new List<string>();

            List<SystemApplicationEntity> list = businessProxy.GetRoleAssignedApplications(role.entity);

            foreach (SystemApplicationEntity applicationEntity in list)
            {
                assignedApplicationIDs.Add(applicationEntity.SystemApplicationID.ToString());
            }

            return assignedApplicationIDs;
        }
Exemple #33
0
        public static List <SystemUserWrapper> GetAllUserByRoleName(string roleName)
        {
            SystemRoleWrapper roleWrapper = SystemRoleWrapper.GetRoleByName(roleName);

            return(ConvertToWrapperList(businessProxy.FindAllUserByRole(roleWrapper.entity)));
        }
Exemple #34
0
 public static List <SystemUserRoleRelationWrapper> FindAllByOrderByAndFilterAndRoleID(string orderByColumnName, bool isDesc, SystemRoleWrapper roleID, PageQueryParams pageQueryParams)
 {
     return(ConvertToWrapperList(businessProxy.FindAllByOrderByAndFilterAndRoleID(orderByColumnName, isDesc, roleID.entity, pageQueryParams)));
 }
Exemple #35
0
 public static void Refresh(SystemRoleWrapper instance)
 {
     businessProxy.Refresh(instance.entity);
 }
Exemple #36
0
 public static List <SystemUserRoleRelationWrapper> FindAllByRoleID(SystemRoleWrapper roleID)
 {
     return(ConvertToWrapperList(businessProxy.FindAllByRoleID(roleID.entity)));
 }