コード例 #1
0
        /// <summary>
        /// 获取用户分配的所有角色
        /// </summary>
        /// <param name="loginID">登陆ID</param>
        /// <returns></returns>
        public List <SystemRoleWrapper> GetUserAssignedRoleByUserLoginId(string loginID)
        {
            if (loginID == SystemUserWrapper.DEV_USER_ID)
            {
                return(SystemRoleWrapper.ConvertToWrapperList(this.DataObjectsContainerIocID.SystemRoleDataObjectInstance.FindAll()));
            }


            SystemUserEntity        user = SelfDataObj.GetUserByLoginID(loginID);
            List <SystemRoleEntity> list = this.DataObjectsContainerIocID.SystemUserRoleRelationDataObjectInstance.GetUserAssignedRoles(user);

            foreach (SystemRoleEntity role in list)
            {
                this.DataObjectsContainerIocID.SystemRoleDataObjectInstance.InitializeLazyProperty(role, SystemRoleEntity.PROPERTY_NAME_ROLEID);
                this.DataObjectsContainerIocID.SystemRoleDataObjectInstance.InitializeLazyProperty(role, SystemRoleEntity.PROPERTY_NAME_ROLENAME);
                this.DataObjectsContainerIocID.SystemRoleDataObjectInstance.InitializeLazyProperty(role, SystemRoleEntity.PROPERTY_NAME_ROLEDESCRIPTION);
                this.DataObjectsContainerIocID.SystemRoleDataObjectInstance.InitializeLazyProperty(role, SystemRoleEntity.PROPERTY_NAME_ROLEISSYSTEMROLE);
            }
            return(SystemRoleWrapper.ConvertToWrapperList(list));
        }