Subject | Re: [firebird-support] Quick way of giving permissions? |
---|---|
Author | Nick Upson |
Post date | 2006-12-11T14:34:38Z |
CREATE OR ALTER PROCEDURE PR_SYS_GRANTALL
AS
declare variable result Varchar(64);
declare variable stmt Varchar(100);
begin
/*
Purpose : grant correct permissions to all tables and procedures
*/
FOR SELECT R.RDB$RELATION_NAME
FROM RDB$RELATIONS R
WHERE R.RDB$SYSTEM_FLAG = 0
AND NOT EXISTS ( SELECT * FROM RDB$USER_PRIVILEGES P
WHERE R.RDB$RELATION_NAME = P.RDB$RELATION_NAME
AND P.RDB$USER = 'PUBLIC' )
INTO :result
DO
BEGIN
STMT = 'GRANT ALL ON ' || result || ' TO PUBLIC';
EXECUTE STATEMENT :STMT;
END
FOR SELECT R.RDB$PROCEDURE_NAME
FROM RDB$PROCEDURES R
WHERE NOT EXISTS ( SELECT * FROM RDB$USER_PRIVILEGES P
WHERE R.RDB$PROCEDURE_NAME = P.RDB$RELATION_NAME
AND P.RDB$USER = 'PUBLIC' )
INTO :result
DO
BEGIN
STMT = 'GRANT EXECUTE ON PROCEDURE ' || result || ' TO PUBLIC';
EXECUTE STATEMENT :STMT;
END
AS
declare variable result Varchar(64);
declare variable stmt Varchar(100);
begin
/*
Purpose : grant correct permissions to all tables and procedures
*/
FOR SELECT R.RDB$RELATION_NAME
FROM RDB$RELATIONS R
WHERE R.RDB$SYSTEM_FLAG = 0
AND NOT EXISTS ( SELECT * FROM RDB$USER_PRIVILEGES P
WHERE R.RDB$RELATION_NAME = P.RDB$RELATION_NAME
AND P.RDB$USER = 'PUBLIC' )
INTO :result
DO
BEGIN
STMT = 'GRANT ALL ON ' || result || ' TO PUBLIC';
EXECUTE STATEMENT :STMT;
END
FOR SELECT R.RDB$PROCEDURE_NAME
FROM RDB$PROCEDURES R
WHERE NOT EXISTS ( SELECT * FROM RDB$USER_PRIVILEGES P
WHERE R.RDB$PROCEDURE_NAME = P.RDB$RELATION_NAME
AND P.RDB$USER = 'PUBLIC' )
INTO :result
DO
BEGIN
STMT = 'GRANT EXECUTE ON PROCEDURE ' || result || ' TO PUBLIC';
EXECUTE STATEMENT :STMT;
END
On 11/12/06, Julio César Carrascal Urquijo <jcarrascal@...> wrote:
> I have several test databases and wanted to give permissions to all
> users so they can do anything SYSDBA can do. These aren't public
> databases so the intended result is loosening security.
>
> Is there a quick and easy way of granting permissions on all objects
> of the database to other users?
>
> Thanks
>
> --
> Julio César Carrascal Urquijo
> http://jcesar.f2o.org/
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>