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); } }
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); }
public static void CreateRole(string roleName) { var role = new SystemRoleWrapper { RoleName = roleName, RoleDescription = "", RoleIsSystemRole = false }; SaveOrUpdate(role); }
public static List <SystemApplicationWrapper> GetRoleAssignedApplications(SystemRoleWrapper role) { if (role == null) { throw new ArgumentNullException("role"); } return(SystemApplicationWrapper.ConvertToWrapperList(businessProxy.GetRoleAssignedApplications(role.entity))); }
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)); }
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); }
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); }
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); }
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); } }
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))); }
public static List<SystemUserRoleRelationWrapper> FindAllByRoleID(SystemRoleWrapper roleID) { return ConvertToWrapperList(businessProxy.FindAllByRoleID(roleID.entity)); }
public static List<SystemApplicationWrapper> GetRoleAssignedApplications(SystemRoleWrapper role) { if (role == null) throw new ArgumentNullException("role"); return SystemApplicationWrapper.ConvertToWrapperList(businessProxy.GetRoleAssignedApplications(role.entity)); }
public static void SaveOrUpdate(SystemRoleWrapper obj) { businessProxy.SaveOrUpdate(obj.entity); }
public static void Refresh(SystemRoleWrapper instance) { businessProxy.Refresh(instance.entity); }
public static void Save(SystemRoleWrapper obj) { businessProxy.Save(obj.entity); }
public static void CreateRole(string roleName) { var role = new SystemRoleWrapper { RoleName = roleName, RoleDescription = "", RoleIsSystemRole = false }; SaveOrUpdate(role); }
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<SystemUserRoleRelationWrapper> FindAllByOrderByAndFilterAndRoleID(string orderByColumnName, bool isDesc, SystemRoleWrapper roleID, PageQueryParams pageQueryParams) { return ConvertToWrapperList(businessProxy.FindAllByOrderByAndFilterAndRoleID(orderByColumnName, isDesc, roleID.entity, pageQueryParams)); }
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); } }
public static List<SystemPrivilegeInRolesWrapper> GetRoleAssignedPrivilegesInRole(SystemRoleWrapper role) { if (role == null) throw new ArgumentNullException("role"); return SystemPrivilegeInRolesWrapper.ConvertToWrapperList(businessProxy.GetRoleAssignedPrivilegesInRole(role.entity)); }
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; }
public static SystemPrivilegeInRolesWrapper GetRelationByRoleAndPrivilege(SystemRoleWrapper systemRoleWrapper, SystemPrivilegeWrapper systemPrivilegeWrapper) { return(ConvertEntityToWrapper(businessProxy.GetRelationByRoleAndPrivilege(systemRoleWrapper.entity, systemPrivilegeWrapper.entity))); }
public static void Update(SystemRoleWrapper obj) { businessProxy.Update(obj.entity); }
public static List <SystemPrivilegeInRolesWrapper> FindAllByRoleID(SystemRoleWrapper roleID) { return(ConvertToWrapperList(businessProxy.FindAllByRoleID(roleID.Entity))); }
public static void Delete(SystemRoleWrapper instance) { businessProxy.Delete(instance.entity); }
public static void Delete(SystemRoleWrapper instance) { businessProxy.Delete(instance.entity); }
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; }
public static List <SystemUserWrapper> GetAllUserByRoleName(string roleName) { SystemRoleWrapper roleWrapper = SystemRoleWrapper.GetRoleByName(roleName); return(ConvertToWrapperList(businessProxy.FindAllUserByRole(roleWrapper.entity))); }
public static List <SystemUserRoleRelationWrapper> FindAllByOrderByAndFilterAndRoleID(string orderByColumnName, bool isDesc, SystemRoleWrapper roleID, PageQueryParams pageQueryParams) { return(ConvertToWrapperList(businessProxy.FindAllByOrderByAndFilterAndRoleID(orderByColumnName, isDesc, roleID.entity, pageQueryParams))); }
public static void Refresh(SystemRoleWrapper instance) { businessProxy.Refresh(instance.entity); }
public static List <SystemUserRoleRelationWrapper> FindAllByRoleID(SystemRoleWrapper roleID) { return(ConvertToWrapperList(businessProxy.FindAllByRoleID(roleID.entity))); }