Exemple #1
0
        public List <string> GetChannelPermissions(int siteId, int channelId)
        {
            var           dictKey = GetChannelPermissionDictKey(siteId, channelId);
            List <string> list;

            if (ChannelPermissionDict.TryGetValue(dictKey, out list))
            {
                return(list);
            }
            return(new List <string>());
        }
        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));
        }
        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;
            }
        }
        public List <string> GetChannelPermissions(int siteId, int channelId)
        {
            var dictKey = GetChannelPermissionDictKey(siteId, channelId);

            return(ChannelPermissionDict.TryGetValue(dictKey, out var list) ? list : new List <string>());
        }