示例#1
0
        public void Revoke(OrderedHashSet <string> granteeList, ISchemaObject dbObject, Right rights, Grantee grantor, bool grantOption, bool cascade)
        {
            RoutineSchema schema = dbObject as RoutineSchema;

            if (schema != null)
            {
                ISchemaObject[] specificRoutines = schema.GetSpecificRoutines();
                this.Revoke(granteeList, specificRoutines, rights, grantor, grantOption, cascade);
            }
            else
            {
                QNameManager.QName specificName = dbObject.GetName();
                Routine            routine      = dbObject as Routine;
                if (routine != null)
                {
                    specificName = routine.GetSpecificName();
                }
                if (!grantor.IsFullyAccessibleByRole(specificName))
                {
                    throw Error.GetError(0x157d, dbObject.GetName().Name);
                }
                if (grantor.IsAdmin())
                {
                    grantor = dbObject.GetOwner();
                }
                for (int i = 0; i < granteeList.Size(); i++)
                {
                    string str = granteeList.Get(i);
                    if (this.Get(str) == null)
                    {
                        throw Error.GetError(0xfa1, str);
                    }
                    if (IsImmutable(str))
                    {
                        throw Error.GetError(0xfa2, str);
                    }
                }
                for (int j = 0; j < granteeList.Size(); j++)
                {
                    string  str2 = granteeList.Get(j);
                    Grantee role = this.Get(str2);
                    role.Revoke(dbObject, rights, grantor, grantOption);
                    role.UpdateAllRights();
                    if (role.IsRole)
                    {
                        this.UpdateAllRights(role);
                    }
                }
            }
        }
示例#2
0
 private void UpdateAllRights(Grantee role)
 {
     for (int i = 0; i < this._map.Size(); i++)
     {
         Grantee grantee = this._map.Get(i);
         if (grantee.IsRole)
         {
             grantee.UpdateNestedRoles(role);
         }
     }
     for (int j = 0; j < this._map.Size(); j++)
     {
         Grantee grantee2 = this._map.Get(j);
         if (!grantee2.IsRole)
         {
             grantee2.UpdateAllRights();
         }
     }
 }
示例#3
0
        public void Revoke(string granteeName, string roleName, Grantee grantor)
        {
            if (!grantor.IsAdmin())
            {
                throw Error.GetError(0x1583);
            }
            Grantee role = this.Get(granteeName);

            if (role == null)
            {
                throw Error.GetError(0xfa0, granteeName);
            }
            Grantee grantee2 = this._roleMap.Get(roleName);

            role.Revoke(grantee2);
            role.UpdateAllRights();
            if (role.IsRole)
            {
                this.UpdateAllRights(role);
            }
        }
示例#4
0
        public void Grant(string granteeName, string roleName, Grantee grantor)
        {
            Grantee role = this.Get(granteeName);

            if (role == null)
            {
                throw Error.GetError(0xfa1, granteeName);
            }
            if (IsImmutable(granteeName))
            {
                throw Error.GetError(0xfa2, granteeName);
            }
            Grantee grantee2 = this.GetRole(roleName);

            if (grantee2 == null)
            {
                throw Error.GetError(0x898, roleName);
            }
            if (grantee2 == role)
            {
                throw Error.GetError(0x8cb, granteeName);
            }
            if (grantee2.HasRole(role))
            {
                throw Error.GetError(0x8cb, roleName);
            }
            if (!grantor.IsGrantable(grantee2))
            {
                throw Error.GetError(0x7d0, grantor.GetNameString());
            }
            role.Grant(grantee2);
            role.UpdateAllRights();
            if (role.IsRole)
            {
                this.UpdateAllRights(role);
            }
        }