示例#1
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);
        }
        /// <summary>
        /// 获取用户分配的所有菜单,如果是developmentAdmin直接获取所有的菜单。
        /// </summary>
        /// <param name="loginID">用户登陆ID</param>
        /// <returns></returns>
        public static List <SystemMenuWrapper> GetUserAssignedMenuByUserLoginID(string loginID)
        {
            List <SystemApplicationWrapper> applications = SystemApplicationWrapper.GetUserAvaiableApplications(SystemUserWrapper.FindByLoginID(loginID));

            List <SystemMenuWrapper> assignedMenus = new List <SystemMenuWrapper>();

            List <SystemMenuEntity> menus = businessProxy.GetUserAssignedMenuByLoginID(loginID);

            if (menus == null)
            {
                return(assignedMenus);
            }

            foreach (SystemMenuEntity systemMenuWrapper in menus)
            {
                if (applications.Exists(p => (p.SystemApplicationID == systemMenuWrapper.ApplicationID.SystemApplicationID)))
                {
                    assignedMenus.Add(ConvertEntityToWrapper(systemMenuWrapper));
                }
            }

            return(assignedMenus);
        }