Beispiel #1
0
        public List <RoleAuthorizeEntity> GetList(string ObjectId)
        {
            cacheKey = cacheKey + "0_" + ObjectId;//拼接有参key值
            var cacheList = cache.GetCache <List <RoleAuthorizeEntity> >(cacheKey);

            if (cacheList == null)
            {
                cacheList = service.IQueryable(t => t.F_ObjectId == ObjectId).ToList();
                cache.WriteCache <List <RoleAuthorizeEntity> >(cacheList, cacheKey, "UserCacheDependency", "Sys_RoleAuthorize");
            }
            return(cacheList);
        }
        /// <summary>
        /// 根据角色获取菜单条目
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <returns></returns>
        public async Task <List <MenuEntity> > GetMenuListByRoleId(string roleId, string tenantId, string isSystem)
        {
            var data = new List <MenuEntity>();

            if (isSystem == null)
            {
                return(null);
            }
            if (isSystem.ToBool())
            {
                data = await this.GetList(tenantId);
            }
            else
            {
                var menuData = await this.GetList(tenantId);

                var authmenudata = await roleAuthRepo.IQueryable(t => t.ObjectId == roleId && t.ItemType == 1 && t.TenantId == tenantId).ToListAsync();

                foreach (var item in authmenudata)
                {
                    MenuEntity moduleEntity = menuData.Find(t => t.Id == item.ItemId && t.TenantId == tenantId);
                    if (moduleEntity != null)
                    {
                        data.Add(moduleEntity);
                    }
                }
            }
            return(data.OrderBy(t => t.SortCode).ToList());
        }
        /// <summary>
        /// 根据角色获取菜单条目
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <returns></returns>
        public async Task <List <MenuEntity> > GetMenuListByRoleId(string roleId)
        {
            var data     = new List <MenuEntity>();
            var isSystem = context.User.Claims.FirstOrDefault(t => t.Type == OperatorModelClaimNames.IsSystem).Value;

            if (isSystem == null)
            {
                return(null);
            }
            if (isSystem.ToBool())
            {
                data = await this.GetList();
            }
            else
            {
                var menuData = await this.GetList();

                var authmenudata = await roleAuthRepo.IQueryable(t => t.ObjectId == roleId && t.ItemType == 1).ToListAsync();

                foreach (var item in authmenudata)
                {
                    MenuEntity moduleEntity = menuData.Find(t => t.Id == item.ItemId);
                    if (moduleEntity != null)
                    {
                        data.Add(moduleEntity);
                    }
                }
            }
            return(data.OrderBy(t => t.SortCode).ToList());
        }
        /// <summary>
        /// 根据角色获取表单按钮列表
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <returns>菜单按钮对象</returns>
        public async Task <List <MenuButtonEntity> > GetButtonListByRoleId(string roleId)
        {
            var data     = new List <MenuButtonEntity>();
            var isSystem = context.User.Claims.First(t => t.Type == OperatorModelClaimNames.IsSystem).Value;

            if (isSystem.ToBool())
            {
                data = await this.GetList();
            }
            else
            {
                var buttondata = await this.GetList();

                //获取授权过的按钮
                var authorizedata = await roleAuthRepo.IQueryable(t => t.ObjectId == roleId && t.ItemType == 2).ToListAsync();

                foreach (var item in authorizedata)
                {
                    MenuButtonEntity menuButtonEntity = buttondata.Find(t => t.Id == item.ItemId);
                    if (menuButtonEntity != null)
                    {
                        data.Add(menuButtonEntity);
                    }
                }
            }
            return(data.OrderBy(t => t.SortCode).ToList());
        }
        /// <summary>
        /// 根据角色获取表单按钮列表
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <returns>菜单按钮对象</returns>
        public async Task <List <MenuButtonEntity> > GetButtonListByRoleId(string roleId, bool isSystem, string tenantId)
        {
            var data = new List <MenuButtonEntity>();

            if (isSystem.ToBool())
            {
                data = await this.GetList(tenantId);
            }
            else
            {
                var buttondata = await this.GetList(tenantId);

                //获取授权过的按钮
                var authorizedata = await roleAuthRepo.IQueryable(t => t.ObjectId == roleId && t.ItemType == 2).ToListAsync();

                foreach (var item in authorizedata)
                {
                    MenuButtonEntity menuButtonEntity = buttondata.Find(t => t.Id == item.ItemId);
                    if (menuButtonEntity != null)
                    {
                        data.Add(menuButtonEntity);
                    }
                }
            }
            return(data.OrderBy(t => t.SortCode).ToList());
        }
Beispiel #6
0
        public List <RoleAuthorize> GetList(string roleId, string roleAuthType)
        {
            var e = ExtLinq.True <RoleAuthorize>();

            e = e.And(x => (x.DeleteMark == null ? false : x.DeleteMark) != true);
            e = e.And(x => x.RoleID == roleId);
            var list = roleAuthorize.IQueryable(e).ToList();

            return(list);
        }
Beispiel #7
0
        /// <summary>
        /// 获得用户的所有权限信息列表【全部】
        /// </summary>
        /// <param name="ObjectId"></param>
        /// <returns></returns>
        public List <RoleAuthorizeEntity> GetList(string ObjectId)
        {
            ResultClass <IQueryable <RoleAuthorizeEntity> > _ret = service.IQueryable(t => t.F_ObjectId == ObjectId);

            if (_ret.Result)
            {
                return(_ret.ResultData.ToList());
            }
            return(new List <RoleAuthorizeEntity>());
        }
 //获取角色权限列表
 public List <RoleAuthorizeEntity> GetList(string ObjectId)
 {
     return(service.IQueryable(t => t.F_ObjectId == ObjectId).ToList());
 }
Beispiel #9
0
 public List <Sys_RoleAuthorize> GetList(string ObjectId)
 {
     return(service.IQueryable <Sys_RoleAuthorize>(t => t.F_ObjectId == ObjectId).ToList());
 }
Beispiel #10
0
 public List <RoleAuthorizeEntity> GetList()
 {
     return(service.IQueryable().ToList());
 }
 public List <SysRoleauthorize> GetList(string ObjectId)
 {
     return(service.IQueryable(t => t.FObjectId == ObjectId).ToList());
 }
 /// <summary>
 /// 根据权限所有者对象id获取所有授权对象
 /// </summary>
 /// <param name="ObjectId">权限所有者对象Id(OwnerId)</param>
 /// <returns>授权对象</returns>
 public Task <List <RoleAuthorizeEntity> > GetListByObjectId(string ObjectId)
 {
     return(service.IQueryable(t => t.ObjectId == ObjectId).ToListAsync());
 }