Beispiel #1
0
        private void LoadPermission()
        {
            BLLJuActivity juActivityBll = new BLLJuActivity();

            ZentCloud.BLLPermission.BLLMenuPermission permissionBll = new ZentCloud.BLLPermission.BLLMenuPermission("");
            StringBuilder          sb         = new StringBuilder();
            int                    columCount = 3;
            int                    _w         = 740 / columCount;
            List <ArticleCategory> cateList   = juActivityBll.GetList <ArticleCategory>(string.Format("WebsiteOwner='{0}' And CategoryType='{1}' Order by Sort", juActivityBll.WebsiteOwner, "Permission"));

            foreach (var cateitem in cateList)
            {
                List <ZentCloud.BLLPermission.Model.PermissionInfo> pmsGroup = permissionBll.GetList <ZentCloud.BLLPermission.Model.PermissionInfo>(string.Format(" PermissionCateId={0} order by PermissionID DESC", cateitem.AutoID));
                if (pmsGroup.Count > 0)
                {
                    sb.AppendFormat("<fieldset style=\"padding: 0px 10px 10px 10px; margin-top:10px; \">");
                    sb.AppendFormat("<legend><input id=\"cb_{0}\" title=\"{1}\" type=\"checkbox\" name=\"checktype\" class=\"positionTop2\" value=\"{0}\" /> <label title=\"{1}\" for=\"cb_{0}\">{1}</label></legend>", cateitem.AutoID, cateitem.CategoryName);
                    sb.AppendFormat("<ul style=\"width:100%;\">");

                    for (int i = 0; i < pmsGroup.Count; i++)
                    {
                        sb.AppendFormat("<li style=\"width:{0}px;float:left;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;\">", _w);
                        sb.AppendFormat(string.Format(@"<input id=""cb_{0}"" title=""{2}"" type=""checkbox"" name=""checksingle"" class=""positionTop2"" value=""{0}"" /> <label title=""{2}"" for=""cb_{0}"">{1}</label><br />", pmsGroup[i].PermissionID, pmsGroup[i].PermissionName, string.IsNullOrWhiteSpace(pmsGroup[i].PermissionDescription) ? pmsGroup[i].PermissionName : pmsGroup[i].PermissionDescription));
                        sb.AppendFormat("</li>");
                    }
                    sb.AppendFormat("</ul>");
                    sb.AppendFormat("</fieldset>");
                }
            }
            string cateIds = ZentCloud.Common.MyStringHelper.ListToStr(cateList.Select(p => p.AutoID).ToList(), "", ",");

            if (string.IsNullOrWhiteSpace(cateIds))
            {
                cateIds = "-1";
            }
            List <ZentCloud.BLLPermission.Model.PermissionInfo> pmsGroup1 = new ZentCloud.BLLPermission.BLLMenuPermission("").GetList <ZentCloud.BLLPermission.Model.PermissionInfo>(string.Format(" PermissionCateId Not In ({0}) order by PermissionID DESC", cateIds));

            if (pmsGroup1.Count > 0)
            {
                sb.AppendFormat("<fieldset style=\"0px 10px 10px 10px; margin-top:10px;\">");
                sb.AppendFormat("<legend><input id=\"cb_{0}\" title=\"{1}\" type=\"checkbox\" name=\"checktype\" class=\"positionTop2\" value=\"{0}\" /> <label title=\"{1}\" for=\"cb_{0}\">{1}</label></legend>", 0, "未分类");
                sb.AppendFormat("<ul style=\"width:100%;\">");

                for (int i = 0; i < pmsGroup1.Count; i++)
                {
                    sb.AppendFormat("<li style=\"width:{0}px;float:left;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;\">", _w);
                    sb.AppendFormat(string.Format(@"<input id=""cb_{0}"" title=""{2}"" type=""checkbox"" name=""checksingle"" class=""positionTop2"" value=""{0}"" /> <label title=""{2}"" for=""cb_{0}"">{1}</label><br />", pmsGroup1[i].PermissionID, pmsGroup1[i].PermissionName, string.IsNullOrWhiteSpace(pmsGroup1[i].PermissionDescription) ? pmsGroup1[i].PermissionName : pmsGroup1[i].PermissionDescription));
                    sb.AppendFormat("</li>");
                }
                sb.AppendFormat("</ul>");
                sb.AppendFormat("</fieldset>");
            }
            PermissionHtml = sb.ToString();
        }
Beispiel #2
0
        /// <summary>
        /// 查询用户权限组ID列表
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public List <PermissionGroupInfo> GetUserGroupList(string userId, string websiteOwner, int groupType)
        {
            BLLMenuPermission bllUserPmsGroupRelation = new BLLMenuPermission("");
            List <long>       groupIDList             = bllUserPmsGroupRelation.BaseCacheGetUserPmsGroupRelationList(userId)
                                                        .Select(p => p.GroupID).ToList();

            if (groupIDList.Count >= 0)
            {
                string groupIDStrs = MyStringHelper.ListToStr(groupIDList, "'", ",");
                return(GetGroupList(int.MaxValue, 1, null, websiteOwner, groupIDStrs, groupType));
            }
            return(new List <PermissionGroupInfo>());
        }
Beispiel #3
0
        /// <summary>
        /// 检查当前用户权限
        /// </summary>
        /// <param name="pmsID"></param>
        /// <returns></returns>
        public static bool CheckCurrUserPms(long pmsID)
        {
            bool result = false;

            try
            {
                ZentCloud.BLLPermission.BLLMenuPermission bll = new ZentCloud.BLLPermission.BLLMenuPermission("");
                result = bll.CheckUserAndPms(GetCurrUserID(), pmsID);
            }
            catch { }

            return(result);
        }
Beispiel #4
0
        /// <summary>
        /// 获取站点权限关系
        /// </summary>
        /// <returns></returns>
        public List <PermissionRelationInfo> GetWebsiteOwnerRelationList(string websiteOwner, int relationType)
        {
            BLLMenuPermission bllLMenuPermission = new BLLMenuPermission("");
            List <long>       listRelation       = bllLMenuPermission.BaseCacheGetUserPmsGroupRelationList(websiteOwner)
                                                   .Select(p => p.GroupID).ToList();

            if (listRelation.Count == 0)
            {
                return(new List <PermissionRelationInfo>());
            }
            string GroupIDs = ZentCloud.Common.MyStringHelper.ListToStr(listRelation, "'", ",");

            return(GetMultPermissionRelationList(GroupIDs, relationType));
        }
Beispiel #5
0
        /// <summary>
        /// 检查站点是否包含某个权限Key
        /// </summary>
        /// <param name="userId">账户</param>
        /// <param name="permissionKey">权限key </param>
        /// <returns></returns>
        public bool CheckPermissionKey(string userId, ZentCloud.BLLPermission.Enums.PermissionSysKey permissionKey)
        {
            string                permissionKeyStr = EnumToString(permissionKey);
            BLLMenuPermission     bllMenuper       = new BLLMenuPermission("");
            List <PermissionInfo> pmsList          = new List <PermissionInfo>();
            string                strPsmIds        = "0";
            List <long>           psmIds           = bllMenuper.GetUserAllPmsID(userId);

            if (psmIds.Count() > 0)
            {
                strPsmIds = MyStringHelper.ListToStr(psmIds, "'", ",");
            }
            pmsList = bllMenuper.GetList <PermissionInfo>(string.Format(" PermissionKey>'' AND PermissionID in ({0})", strPsmIds));
            //过滤掉已经禁止的权限
            var disPmsList = GetMultPermissionRelationList("'" + userId + "'", 9);

            pmsList = pmsList.Where(p => disPmsList.Count(dis => dis.PermissionID == p.PermissionID) == 0).ToList();
            if (pmsList != null)
            {
                return(pmsList.Count(p => p.PermissionKey == permissionKeyStr) > 0);
            }
            return(false);
        }