public PublicAccessEntry(IContent protectedNode, IContent loginNode, IContent noAccessNode, IEnumerable <PublicAccessRule> ruleCollection)
        {
            if (protectedNode == null)
            {
                throw new ArgumentNullException(nameof(protectedNode));
            }
            if (loginNode == null)
            {
                throw new ArgumentNullException(nameof(loginNode));
            }
            if (noAccessNode == null)
            {
                throw new ArgumentNullException(nameof(noAccessNode));
            }

            LoginNodeId      = loginNode.Id;
            NoAccessNodeId   = noAccessNode.Id;
            _protectedNodeId = protectedNode.Id;

            _ruleCollection = new EventClearingObservableCollection <PublicAccessRule>(ruleCollection);
            _ruleCollection.CollectionChanged += _ruleCollection_CollectionChanged;

            foreach (var rule in _ruleCollection)
            {
                rule.AccessEntryId = Key;
            }
        }
示例#2
0
        private BackOfficeIdentityUser(IReadOnlyUserGroup[] groups)
        {
            _startMediaIds   = Array.Empty <int>();
            _startContentIds = Array.Empty <int>();
            _allowedSections = Array.Empty <string>();
            _culture         = Current.Configs.Global().DefaultUILanguage; // TODO: inject

            // must initialize before setting groups
            _roles = new EventClearingObservableCollection <IdentityUserRole <string> >();
            _roles.CollectionChanged += _roles_CollectionChanged;

            // use the property setters - they do more than just setting a field
            Groups = groups;
        }
        public PublicAccessEntry(Guid id, int protectedNodeId, int loginNodeId, int noAccessNodeId, IEnumerable <PublicAccessRule> ruleCollection)
        {
            Key = id;
            Id  = Key.GetHashCode();

            LoginNodeId      = loginNodeId;
            NoAccessNodeId   = noAccessNodeId;
            _protectedNodeId = protectedNodeId;

            _ruleCollection = new EventClearingObservableCollection <PublicAccessRule>(ruleCollection);
            _ruleCollection.CollectionChanged += _ruleCollection_CollectionChanged;

            foreach (var rule in _ruleCollection)
            {
                rule.AccessEntryId = Key;
            }
        }