コード例 #1
0
        public bool HasChannelPermissions(int siteId, int channelId)
        {
            if (channelId == 0)
            {
                return(false);
            }
            if (IsSystemAdministrator)
            {
                return(true);
            }
            var dictKey = GetChannelPermissionDictKey(siteId, channelId);

            if (ChannelPermissionDict.ContainsKey(dictKey))
            {
                return(true);
            }

            var parentChannelId = ChannelManager.GetParentId(siteId, channelId);

            return(HasChannelPermissions(siteId, parentChannelId));
        }
コード例 #2
0
        public bool HasChannelPermissions(int siteId, int channelId, params string[] permissions)
        {
            while (true)
            {
                if (channelId == 0)
                {
                    return(false);
                }
                if (IsSystemAdministrator)
                {
                    return(true);
                }
                var dictKey = GetChannelPermissionDictKey(siteId, channelId);
                if (ChannelPermissionDict.ContainsKey(dictKey) && HasChannelPermissions(ChannelPermissionDict[dictKey], permissions))
                {
                    return(true);
                }

                var parentChannelId = ChannelManager.GetParentId(siteId, channelId);
                channelId = parentChannelId;
            }
        }