Пример #1
0
        private void SetDataByModule(SysModule mdl)
        {
            SysAuth[] pAuths;
            SysAuth   pAuth = null;

            // 获取父权限(与系统模块对应)
            if (!String.IsNullOrEmpty(mdl.ParentID))
            {
                pAuths = SysAuth.FindAllByProperties("ModuleID", mdl.ParentID);
            }
            else
            {
                pAuths = SysAuth.FindAllByProperties("Data", mdl.ApplicationID);
            }

            if (pAuths.Length > 0)
            {
                pAuth          = pAuths[0];
                this.ParentID  = pAuth.AuthID;
                this.Path      = String.Format("{0}.{1}", pAuth.Path, pAuth.AuthID);
                this.PathLevel = (pAuth.PathLevel == null ? 0 : (pAuth.PathLevel + 1));
            }

            this.Name        = mdl.Name;
            this.Code        = String.Format("AUTH_MDL_{0}", mdl.Code);
            this.Type        = 1; // 1为系统入口权限
            this.SortIndex   = mdl.SortIndex;
            this.ModuleID    = mdl.ModuleID;
            this.Description = String.Format("模块 {0} 访问权限", mdl.Name);
        }
Пример #2
0
 /// <summary>
 /// 获取相关权限
 /// </summary>
 /// <returns></returns>
 public SysAuth[] GetRelatedAuth()
 {
     // Type为1 代表应用权限
     SysAuth[] auths = SysAuth.FindAllByProperties("Type", 1, "Data", this.ApplicationID);
     return(auths);
 }
 /// <summary>
 /// 获取相关权限
 /// </summary>
 /// <returns></returns>
 public SysAuth[] GetRelatedAuth()
 {
     // Type为1 代表应用权限
     SysAuth[] auths = SysAuth.FindAllByProperties("Type", 1, "ModuleID", this.ModuleID);
     return(auths);
 }