Subject Re: [firebird-support] Quick way of giving permissions?
Author Julio César Carrascal Urquijo
I arrived to the pretty much the same solution after sending the
email. Incredibly how much similar our stored procedures are. :D

Thanks.



On 12/11/06, Nick Upson <nick.upson@...> wrote:
> 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
>
> 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
> >
> >
> >
> >
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> 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
>
>
>
>


--
Julio César Carrascal Urquijo
http://jcesar.f2o.org/

"Did you know that the first version of C++ was designed to be perfect? Where
none suffered, where everyone would be happy. It was a disaster. No one would
accept it. Entire programmers were lost. Some believed we lacked the means to
describe your perfect language. But I believe that, as a species, human beings
define their reality through suffering and misery. The perfect language was a
dream that your primitive cerebrum kept trying to wake up from. Which is why
C++ was redesigned to this: the peak of its popularity."
- El Agente Smith en Matrix... Bueno... No. En realidad no.