Esempio n. 1
0
        /// <summary>
        /// Combines another entity right to this one.
        /// </summary>
        internal EntityRight Combine(EntityRight otherEntityRight)
        {
            if (otherEntityRight == null)
            {
                throw new ArgumentNullException(nameof(otherEntityRight));
            }

            this.CanCreate    = this.CanCreate || otherEntityRight.CanCreate;
            this.CanCreateOwn = this.CanCreateOwn || otherEntityRight.CanCreateOwn;
            this.CanRead      = this.CanRead || otherEntityRight.CanRead;
            this.CanReadOwn   = this.CanReadOwn || otherEntityRight.CanReadOwn;
            this.CanWrite     = this.CanWrite || otherEntityRight.CanWrite;
            this.CanWriteOwn  = this.CanWriteOwn || otherEntityRight.CanWriteOwn;
            this.CanDelete    = this.CanDelete || otherEntityRight.CanDelete;
            this.CanDeleteOwn = this.CanDeleteOwn || otherEntityRight.CanDeleteOwn;

            return(this);
        }
Esempio n. 2
0
        internal void CombineEntityRight(string entityClassName, EntityRight entityRight)
        {
            if (entityClassName == null)
            {
                throw new ArgumentNullException(nameof(entityClassName));
            }
            if (entityRight == null)
            {
                throw new ArgumentNullException(nameof(entityRight));
            }


            if (!entityRights.TryGetValue(entityClassName, out EntityRight existingEntityRight))
            {
                existingEntityRight = new EntityRight();

                entityRights[entityClassName] = existingEntityRight;
            }

            existingEntityRight.Combine(entityRight);
        }