Board index » delphi » Finding Current User's Role?

Finding Current User's Role?

Is there a quick way to find out if the current user executing sql
statements has a specific role?  For example, in a trigger I would like to
execute a block of code if the current user modifying a table is assigned
the role 'FOOBAR'.

thanks,
jB

 

Re:Finding Current User's Role?


Quote
James Berry wrote:

> Is there a quick way to find out if the current user executing sql
> statements has a specific role?  

        Unfortunately, no.  The only thing you can do is try your INSERT and
see if it works.

        HTH,

        -Craig

--
Craig Stuntz (TeamB)       Senior Developer, Vertex Systems Corp.
Delphi/InterBase weblog:   http://delphi.weblogs.com
Use Borland servers; posts via others are not seen by TeamB.
For more info, see http://www.borland.com/newsgroups/genl_faqs.html

Re:Finding Current User's Role?


Quote
"Craig Stuntz (TeamB)" wrote:

> James Berry wrote:

> > Is there a quick way to find out if the current user executing sql
> > statements has a specific role?

>         Unfortunately, no.  The only thing you can do is try your INSERT and
> see if it works.

  Hi, Craig. Is'nt

If Exists
(Select 1 From RDB$USER_PRIVILEGES
  Where RDB$USER=USER and RDB$RELATION_NAME='FOOBAR'
    And RDB$OBJECT_TYPE=13)
then
 begin
   ...
 end

reliable? Or is it Firebird specific (I have'nt IB6 now)?

Best regards.

Re:Finding Current User's Role?


Hi Ded,

depends on the need of James. If you want to get the role membership for a
given user than yes, but getting the users role used for connecting to a
database (like USER for the actual connected user) isn't possible.

--
Best Regards
Thomas Steinmaurer
IB LogManager - The Logging Tool for Interbase/Firebird
http://www.iblogmanager.com
"Ded" <d...@hq.bereg.net> schrieb im Newsbeitrag
news:3B572E4B.ACAE1DE9@hq.bereg.net...

Quote
> "Craig Stuntz (TeamB)" wrote:

> > James Berry wrote:

> > > Is there a quick way to find out if the current user executing sql
> > > statements has a specific role?

> >         Unfortunately, no.  The only thing you can do is try your INSERT
and
> > see if it works.

>   Hi, Craig. Is'nt

> If Exists
> (Select 1 From RDB$USER_PRIVILEGES
>   Where RDB$USER=USER and RDB$RELATION_NAME='FOOBAR'
>     And RDB$OBJECT_TYPE=13)
> then
>  begin
>    ...
>  end

> reliable? Or is it Firebird specific (I have'nt IB6 now)?

> Best regards.

Re:Finding Current User's Role?


Quote
Ded wrote:

>   Hi, Craig. Is'nt

> If Exists
> (Select 1 From RDB$USER_PRIVILEGES
>   Where RDB$USER=USER and RDB$RELATION_NAME='FOOBAR'
>     And RDB$OBJECT_TYPE=13)
> then
>  begin
>    ...
>  end

> reliable? Or is it Firebird specific (I have'nt IB6 now)?

        The query works fine on IB, but it doesn't answer James's question, I
think.

        -Craig

--
Craig Stuntz (TeamB)       Senior Developer, Vertex Systems Corp.
Delphi/InterBase weblog:   http://delphi.weblogs.com
Use Borland servers; posts via others are not seen by TeamB.
For more info, see http://www.borland.com/newsgroups/genl_faqs.html

Re:Finding Current User's Role?


  Once more my English? :)) I'm sorry.

Best regards.

Re:Finding Current User's Role?


  Gentlemen, all of us forgot about CURRENT_ROLE in Firebird since build
281! (snapshot).

Best regards.

Other Threads