Subject | Re: Agregate rights to user from roles |
---|---|
Author | nasca_ams |
Post date | 2004-06-26T22:03:06Z |
> > user: User to grant the privilegesRDB$PRIVILEGE,
> > role: Role from suply the privileges
> >
> > insert into RDB$USER_PRIVILEGES (RDB$USER, RDB$GRANTOR,
> > RDB$GRANT_OPTION, RDB$RELATION_NAME, RDB$FIELD_NAME,RDB$USER_TYPE,
> > RDB$OBJECT_TYPE)Not still but I have seen several examples seemed:
> > select :user, RDB$GRANTOR, RDB$PRIVILEGE, NULL, RDB$RELATION_NAME,
> > RDB$FIELD_NAME, 8, 0
> > from RDB$USER_PRIVILEGES
> > where (RDB$USER_PRIVILEGES = :role)
> >
>
> looks interesting - why don't you try it on a copy of the database?
http://www.bcp-software.nl/ib/changedatabaseowner.html
http://www.bcp-software.nl/ib/changerelationowner.html
Other form is translate the record of:
select RDB$GRANTOR, RDB$PRIVILEGE, RDB$RELATION_NAME,
RDB$FIELD_NAME
from RDB$USER_PRIVILEGES
where (RDB$USER_PRIVILEGES = :role)
to sentences sql for grant privileges executeed for the user RDB$GRANTOR, the
owner and admin of database.
I not have stydyed the language for stored procedures, in dirty pseudo-code:
case RDB$PRIVILEGE
S:
grant SELECT FROM RDB$RELATION_NAME to :user;
I:
grant INSERT FROM RDB$RELATION_NAME to :user;
U:
(
if not(RDB$FIELD_NAME is null) then
grant UPDATE(RDB$FIELD_NAME) FROM RDB$RELATION_NAME to :user
else
grant UPDATE FROM RDB$RELATION_NAME to :user
)
...
..
.