Subject Re: Agregate rights to user from roles
Author nasca_ams
> > user: User to grant the privileges
> > role: Role from suply the privileges
> >
> > insert into RDB$USER_PRIVILEGES (RDB$USER, RDB$GRANTOR,
RDB$PRIVILEGE,
> > RDB$GRANT_OPTION, RDB$RELATION_NAME, RDB$FIELD_NAME,
RDB$USER_TYPE,
> > RDB$OBJECT_TYPE)
> > 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?

Not still but I have seen several examples seemed:

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
)
...
..
.