Exemple #1
0
        /// <summary>
        /// 获取树视图(根据令牌)
        /// </summary>
        /// <param name="access_token">登录token</param>
        /// <returns></returns>
        public List <TreeViewDTO> AccessibleTreeView(string access_token)
        {
            IRAPLog     log  = new IRAPLog();
            LoginEntity logE = log.GetLogIDByToken(access_token);

            if (logE == null)
            {
                int    errCode = 99;
                string errText = "无法访问树数据,令牌无效!";
                throw new Exception($"{errCode}-{errText}");
            }
            return(AccessibleTreeView(logE.AgencyLeaf, logE.RoleLeaf));
        }
Exemple #2
0
        /// <summary>
        /// 开启业务操作的基础
        /// </summary>
        /// <param name="dbName"></param>
        /// <param name="access_token"></param>
        /// <param name="opID"></param>
        public IRAPOperBase(string dbName, string access_token, int opID)
        {
            _opID             = opID;
            _db               = DBContextFactory.Instance.CreateContext(dbName + "Context");
            this.access_token = access_token;
            var logDB = new IRAPLog();

            log = logDB.GetLogIDByToken(access_token);
            if (log != null)
            {
                _communityID = (int)log.PartitioningKey / 10000;
            }
            if (_communityID == 0)
            {
                throw new Exception($"令牌access_token={access_token}无效!");
            }
        }
Exemple #3
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="db">数据库上下文</param>
        /// <param name="access_token">登录令牌</param>
        /// <param name="opID">业务操作</param>
        public IRAPOperBase(IDbContext db, string access_token, int opID)
        {
            _db               = db;
            _opID             = opID;
            this.access_token = access_token;
            var logDB = new IRAPLog();

            log = logDB.GetLogIDByToken(access_token);
            if (log != null)
            {
                _communityID = (int)log.PartitioningKey / 10000;
            }
            if (_communityID == 0)
            {
                throw new Exception($"令牌access_token={access_token}无效!");
            }
        }
Exemple #4
0
        /// <summary>
        /// 获取可用系统(带权限)
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="progLangID"></param>
        /// <returns></returns>
        public List <SystemDTO> GetAvailableSystems(string access_token, short progLangID)
        {
            IRAPLog          log         = new IRAPLog();
            LoginEntity      logEntity   = log.GetLogIDByToken(access_token);
            int              communityID = (int)(logEntity.PartitioningKey / 10000L);
            var              list        = GetSystemList(progLangID);
            IRAPTreeSet      treeSet     = new IRAPTreeSet(communityID, 3);
            List <SystemDTO> resList     = new List <SystemDTO>();

            foreach (var r in list)
            {
                List <TreeViewDTO> accessList = treeSet.AccessibleTreeView(r.SystemID, logEntity.AgencyLeaf, logEntity.RoleLeaf);
                if (accessList.Count < 2)
                {
                    continue;
                }
                resList.Add(r);
            }
            return(resList);
        }