Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 23rd, 2005, 12:28 AM
Adam Witney
Guest
 
Posts: n/a
Default Can the username calling a function be made available within thefunction?


I'd like to be able to have a PL/pgSQL function defined as SECURITY DEFINER,
but still have access to the calling username within the function. Is this
possible?

I could pass current_user as a parameter, but of course this could easily be
bypassed.

Is there a way of coding this?

Thanks for any help

Adam


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

  #2  
Old November 23rd, 2005, 12:28 AM
Richard Huxton
Guest
 
Posts: n/a
Default Re: Can the username calling a function be made available within the function?

On Wednesday 07 April 2004 11:23, Adam Witney wrote:[color=blue]
> I'd like to be able to have a PL/pgSQL function defined as SECURITY
> DEFINER, but still have access to the calling username within the function.
> Is this possible?
>
> I could pass current_user as a parameter, but of course this could easily
> be bypassed.
>
> Is there a way of coding this?[/color]

Just "SELECT CURRENT_USER" into a variable. You might want SESSION_USER
though.


--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

  #3  
Old November 23rd, 2005, 12:28 AM
Bruno Wolff III
Guest
 
Posts: n/a
Default Re: Can the username calling a function be made available within the function?

On Wed, Apr 07, 2004 at 11:23:25 +0100,
Adam Witney <awitney@sghms.ac.uk> wrote:[color=blue]
>
> I'd like to be able to have a PL/pgSQL function defined as SECURITY DEFINER,
> but still have access to the calling username within the function. Is this
> possible?
>
> I could pass current_user as a parameter, but of course this could easily be
> bypassed.
>
> Is there a way of coding this?[/color]

You probably want session_user.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles