예제 #1
0
        public void Grant(QNameManager.QName name, Right right, Grantee grantor, bool withGrant)
        {
            Right allGrantableRights = grantor.GetAllGrantableRights(name);
            Right right3             = null;

            if (right == Right.FullRights)
            {
                if (allGrantableRights.IsEmpty())
                {
                    return;
                }
                right = allGrantableRights;
            }
            else if (!allGrantableRights.Contains(right))
            {
                throw Error.GetError(0x7d0);
            }
            Iterator <Right> iterator = this._directRightsMap.Get(name);

            while (iterator.HasNext())
            {
                Right right4 = iterator.Next();
                if (right4.Grantor == grantor)
                {
                    right3 = right4;
                    right3.Add(right);
                    break;
                }
            }
            if (right3 == null)
            {
                right3         = right.Duplicate();
                right3.Grantor = grantor;
                right3.grantee = this;
                this._directRightsMap.Put(name, right3);
            }
            if (withGrant)
            {
                if (right3.GrantableRights == null)
                {
                    right3.GrantableRights = right.Duplicate();
                }
                else
                {
                    right3.GrantableRights.Add(right);
                }
            }
            if (!grantor._isSystem)
            {
                grantor._grantedRightsMap.Put(name, right3);
            }
            this.UpdateAllRights();
        }