示例#1
0
        /// <summary>
        /// 获取指定用户的特定类型和属主的资源列表
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="type"></param>
        /// <param name="owner"></param>
        /// <param name="currentrole"></param>
        /// <returns></returns>
        public static List <resource> getUserResource(string username, int type, role currentrole, string owner = "")
        {
            List <resource> rr = new List <resource>();
            IroleResourceEx _roleResourceEx = IocModule.GetEntity <IroleResourceEx>();

            rr.AddRange(_roleResourceEx.getRoleResource(currentrole.id, type, owner));
            rr = rr.Where((x, i) => rr.FindIndex(z => z.id == x.id) == i).ToList();//Lambda表达式去重
            return(rr);
        }
示例#2
0
        public static List <resource> getUserAllResource(string username, string owner = "")//获取指定用户的特定类型和属主的资源列表
        {
            List <resource> rr       = new List <resource>();
            List <role>     rolelist = IocModule.GetEntity <IroleEx>().getUserRoles(username);

            if (rolelist.Count > 0)
            {
                IroleResourceEx _roleResourceEx = IocModule.GetEntity <IroleResourceEx>();
                foreach (var e in rolelist)
                {
                    rr.AddRange(_roleResourceEx.getRoleAllResource(e.id, owner));
                }
                rr = rr.Where((x, i) => rr.FindIndex(z => z.id == x.id) == i).ToList();//Lambda表达式去重
            }
            return(rr);
        }