/// <summary>
 /// 获取模块所属的应用
 /// </summary>
 /// <returns></returns>
 public SysApplication OwnerApplication()
 {
     if (!String.IsNullOrEmpty(ApplicationID))
     {
         return(SysApplication.Find(this.ApplicationID));
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 2
0
 private void SetDataByApplication(SysApplication app)
 {
     this.Name        = app.Name;
     this.Code        = String.Format("AUTH_APP_{0}", app.Code);
     this.Data        = app.ApplicationID;
     this.Path        = ".";
     this.PathLevel   = 0;
     this.ParentID    = null;
     this.Type        = 1; // 1为系统入口权限
     this.Description = String.Format("应用 {0} 访问权限", app.Name);
 }
        /// <summary>
        /// 由权限列表获取所有用户应用
        /// </summary>
        /// <param name="authList"></param>
        /// <returns></returns>
        public static IList <SysApplication> RetrieveAllApplicationFromAuthList(IList <SysAuth> authList)
        {
            IList <SysApplication> apps = new List <SysApplication>();

            List <string> appIDs = new List <string>();

            foreach (SysAuth auth in authList)
            {
                // 类型为1 为入口权限(Application或Module)
                if (auth.Type == 1 && !String.IsNullOrEmpty(auth.Data))
                {
                    appIDs.Add(auth.Data);
                }
            }

            ICriterion hqlCriterion = Expression.In("ApplicationID", appIDs);

            apps = SysApplication.FindAll(hqlCriterion);

            return(apps);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取可访问应用
        /// </summary>
        /// <returns></returns>
        public static IList <SysApplication> GetApplicationsByAuths(IEnumerable <SysAuth> auths)
        {
            IEnumerable <string> appids = auths.Where(v => v.Type == 1 && String.IsNullOrEmpty(v.ModuleID) && !String.IsNullOrEmpty(v.Data)).Select(v => v.Data);

            return(SysApplication.FindAllByPrimaryKeys(appids.ToArray()));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 由系统应用更新权限
        /// </summary>
        public void UpdateByApplication(SysApplication app)
        {
            this.SetDataByApplication(app);  // 根据对应的SysApplication设置数据

            this.DoUpdate();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 由系统应用更新权限
        /// </summary>
        public void UpdateByApplication(string appid)
        {
            SysApplication app = SysApplication.Find(appid);

            this.UpdateByApplication(app);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 有模块键获取模块
        /// </summary>
        /// <param name="code"></param>
        public static SysApplication FindByCode(string code)
        {
            SysApplication app = SysApplication.FindFirstByProperties("Code", code);

            return(app);
        }