Exemplo n.º 1
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);
            }
        }