Exemple #1
0
        /// <summary>
        /// 获取相应层级子级
        /// </summary>
        /// <param name="level">当前层级向下层级</param>
        /// <returns></returns>
        public SysAuth[] GetSubs(int level)
        {
            int currLevel = this.PathLevel.GetValueOrDefault();
            int maxLevel  = this.PathLevel.GetValueOrDefault() + level;

            return(SysAuth.FindAll("PathLevel > ? AND PathLevel <= ?", currLevel, maxLevel));
        }
        /// <summary>
        /// 获取应用权限类型的应用
        /// </summary>
        /// <returns></returns>
        public static IList <SysApplication> GetApplications()
        {
            // Type为1,ID为Data的权限
            DetachedCriteria crits = DetachedCriteria.For <SysAuth>();

            crits.Add(Expression.IsNotNull("Data"));
            crits.Add(Expression.IsNull("ModuleID"));
            crits.Add(Expression.Eq("Type", 1));
            crits.SetResultTransformer(new DistinctRootEntityResultTransformer());
            IList <SysAuth> auths = SysAuth.FindAll(crits);

            return(SysAuthRule.RetrieveAllApplicationFromAuthList(auths));
        }
        /// <summary>
        /// 由ID集合获取权限集合
        /// </summary>
        /// <param name="authIDs"></param>
        /// <returns></returns>
        public static ICollection <SysAuth> GetAuthByIDs(ICollection authIDs)
        {
            ICollection myAuthIDs = null;

            if (authIDs is JArray)
            {
                JArray arrAuths = authIDs as JArray;
                myAuthIDs = new List <string>(arrAuths.Values <string>());
            }
            else
            {
                myAuthIDs = authIDs;
            }

            SysAuth[] tAuths = SysAuth.FindAll(Expression.In("AuthID", myAuthIDs));

            return(tAuths);
        }
Exemple #4
0
        /// <summary>
        /// 获取相应层级子级
        /// </summary>
        /// <returns></returns>
        public SysAuth[] GetSubs()
        {
            int currLevel = this.PathLevel.GetValueOrDefault();

            return(SysAuth.FindAll("PathLevel > ?", currLevel));
        }
 /// <summary>
 /// 查询所有
 /// </summary>
 /// <returns></returns>
 new public static SysAuth[] FindAll()
 {
     return(SysAuth.FindAll("FROM SysAuth auth WHERE auth.AuthID <> ?", '0'));
 }