示例#1
0
        /// <summary>
        /// Removes an entity from the AllowACL
        /// </summary>
        /// <param name="myEntityUUID">The UUID which references the entity.</param>
        /// <param name="myRightUUID">The UUID which references the right to be denied.</param>
        public void RemoveFromDenyACL(EntityUUID myEntityUUID, RightUUID myRightUUID)
        {
            if (myEntityUUID == null)
                throw new ArgumentNullException("The EntityUUID must not be null!");

            if (myRightUUID == null)
                throw new ArgumentNullException("The RightUUID must not be null!");

            lock (_DenyACL)
            {

                if (_DenyACL.ContainsKey(myRightUUID))
                    _DenyACL[myRightUUID].Remove(myEntityUUID);

            }

            isDirty = true;
        }
示例#2
0
        public override void Deserialize(ref SerializationReader mySerializationReader)
        {
            #region Data

            UInt64               _NumberOfACLs;
            RightUUID            _RightUUID;
            EntityUUID           _EntityUUID;
            UInt64               _NumberOfEntityUUIDs;
            HashSet<EntityUUID>  _EntityUUIDHashSet;

            #endregion

            try
            {

                #region NotificationHandling

                _NotificationHandling = (NHAccessControlObject)mySerializationReader.ReadOptimizedByte();

                #endregion

                #region DefaultRule

                _DefaultRule = (DefaultRuleTypes)mySerializationReader.ReadOptimizedByte();

                #endregion

                #region AllowACL

                _AllowACL = new Dictionary<RightUUID, HashSet<EntityUUID>>();

                _NumberOfACLs = mySerializationReader.ReadUInt64();

                for (UInt64 i=0; i<_NumberOfACLs; i++)
                {

                    #region KEY

                    _RightUUID = new RightUUID(mySerializationReader.ReadByteArray());

                    #endregion

                    #region VALUE

                    _EntityUUIDHashSet = new HashSet<EntityUUID>();

                    _NumberOfEntityUUIDs = mySerializationReader.ReadUInt64();

                    for (UInt64 j=0; j<_NumberOfEntityUUIDs; j++)
                    {
                        _EntityUUID = new EntityUUID(mySerializationReader.ReadByteArray());
                        _EntityUUIDHashSet.Add(_EntityUUID);
                    }

                    // Finally... add it to the AllowACL!
                    _AllowACL.Add(_RightUUID, _EntityUUIDHashSet);

                    #endregion

                }

                #endregion

                #region DenyACL

                _DenyACL = new Dictionary<RightUUID, HashSet<EntityUUID>>();

                _NumberOfACLs = mySerializationReader.ReadUInt64();

                for (UInt64 i=0; i<_NumberOfACLs; i++)
                {

                    #region KEY

                    _RightUUID = new RightUUID(mySerializationReader.ReadByteArray());

                    #endregion

                    #region VALUE

                    _EntityUUIDHashSet = new HashSet<EntityUUID>();

                    _NumberOfEntityUUIDs = mySerializationReader.ReadUInt64();

                    for (UInt64 j=0; j<_NumberOfEntityUUIDs; j++)
                    {
                        _EntityUUID = new EntityUUID(mySerializationReader.ReadByteArray());
                        _EntityUUIDHashSet.Add(_EntityUUID);
                    }

                    // Finally... add it to the DenyACL!
                    _DenyACL.Add(_RightUUID, _EntityUUIDHashSet);

                    #endregion

                }

                #endregion

            }

            catch (Exception e)
            {
                throw new GraphFSException_AccessControlObjectCouldNotBeDeserialized("AccessControlObject could not be deserialized!\n\n" + e);
            }
        }
示例#3
0
        /// <summary>
        /// Removes an entity from the AllowACL
        /// </summary>
        /// <param name="myEntityUUID">The UUID which references the entity.</param>
        /// <param name="myRightUUID">The UUID which references the right to be denied.</param>
        public void RemoveFromDenyACL(EntityUUID myEntityUUID, RightUUID myRightUUID)
        {
            if (myEntityUUID == null)
                throw new ArgumentNullException("The EntityUUID must not be null!");

            if (myRightUUID == null)
                throw new ArgumentNullException("The RightUUID must not be null!");

            lock (_DenyACL)
            {

                if (_DenyACL.ContainsKey(myRightUUID))
                {
                    if (_DenyACL[myRightUUID].Remove(myEntityUUID))
                    {
                        _estimatedSize -= EstimatedSizeConstants.CalcUUIDSize(myEntityUUID);
                    }
                }

            }

            isDirty = true;
        }
示例#4
0
        /// <summary>
        /// Add an entity to the DenyACL
        /// </summary>
        /// <param name="myEntityUUID">The UUID which references the entity.</param>
        /// <param name="myRightUUID">The UUID which references the right to be granted.</param>
        public void AddToDenyACL(EntityUUID myEntityUUID, RightUUID myRightUUID)
        {
            if (myEntityUUID == null)
                throw new ArgumentNullException("The EntityUUID must not be null!");

            if (myRightUUID == null)
                throw new ArgumentNullException("The RightUUID must not be null!");

            lock (_DenyACL)
            {

                if (_DenyACL.ContainsKey(myRightUUID))
                    _DenyACL[myRightUUID].Add(myEntityUUID);

                else
                {
                    // Create new RightKey and empty HashSet within the AllowACL
                    HashSet<EntityUUID> _HashSet = new HashSet<EntityUUID>();
                    _HashSet.Add(myEntityUUID);
                    _DenyACL.Add(myRightUUID, _HashSet);
                }

            }

            isDirty = true;
        }
示例#5
0
        /// <summary>
        /// Add an entity to the AllowACL
        /// </summary>
        /// <param name="myEntityUUID">The UUID which references the entity.</param>
        /// <param name="myRightUUID">The UUID which references the right to be granted.</param>
        public void AddToAllowACL(EntityUUID myEntityUUID, RightUUID myRightUUID)
        {
            if (myEntityUUID == null)
                throw new ArgumentNullException("The EntityUUID must not be null!");

            if (myRightUUID == null)
                throw new ArgumentNullException("The RightUUID must not be null!");

            lock (_AllowACL)
            {

                if (_AllowACL.ContainsKey(myRightUUID))
                {
                    _AllowACL[myRightUUID].Add(myEntityUUID);
                }
                else
                {
                    // Create new RightKey and empty HashSet within the AllowACL
                    HashSet<EntityUUID> _HashSet = new HashSet<EntityUUID>();
                    _HashSet.Add(myEntityUUID);
                    _AllowACL.Add(myRightUUID, _HashSet);

                    _estimatedSize += EstimatedSizeConstants.HashSet;
                    _estimatedSize += EstimatedSizeConstants.CalcUUIDSize(myRightUUID);
                }

                _estimatedSize += EstimatedSizeConstants.CalcUUIDSize(myEntityUUID);

            }

            isDirty = true;
        }