Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Current User

3 posts in General Discussion Last posting was on 2007-10-11 14:08:28.0Z
Herman Miller Posted on 2007-10-10 20:34:48.0Z
Sender: 851.470cb033.1804289383@sybase.com
From: Herman Miller
Newsgroups: ianywhere.public.general
Subject: Current User
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <470d3768.19d4.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 10 Oct 2007 13:34:48 -0700
X-Trace: forums-1-dub 1192048488 10.22.241.41 (10 Oct 2007 13:34:48 -0700)
X-Original-Trace: 10 Oct 2007 13:34:48 -0700, 10.22.241.41
Lines: 4
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6395
Article PK: 4734

How can I pass the current user info into a stored
procedured? What is the name of the function? I am
attempting to use integrated security in a reporting package
and need to restrict the user to see only their data.


Reg Domaratzki (iAnywhere Solutions) Posted on 2007-10-11 14:08:28.0Z
From: "Reg Domaratzki \(iAnywhere Solutions\)" <FirstName.LastName@ianywhere.com>
Newsgroups: ianywhere.public.general
References: <470d3768.19d4.1681692777@sybase.com>
Subject: Re: Current User
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: rdomarat-xp.sybase.com
X-Original-NNTP-Posting-Host: rdomarat-xp.sybase.com
Message-ID: <470e2e5c$1@forums-1-dub>
Date: 11 Oct 2007 07:08:28 -0700
X-Trace: forums-1-dub 1192111708 10.25.99.188 (11 Oct 2007 07:08:28 -0700)
X-Original-Trace: 11 Oct 2007 07:08:28 -0700, rdomarat-xp.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6400
Article PK: 4736

You always have access to the current user through the special value called
CURRENT USER. You can access this value inside your stored procedure, or
pass it in if you want.

create procedure CheckPerms()
begin
if ( CURRENT USER = 'DBA' ) then
message 'ok';
else
message 'get out!';
end if;
end;
call CheckPerms;

create procedure CheckPerms2(in @user varchar(128))
begin
if ( @user = 'DBA' ) then
message 'ok';
else
message 'get out!';
end if;
end;
call CheckPerms2( CURRENT USER );

--
Reg Domaratzki, Sybase iAnywhere Solutions
Sybase Certified Professional - Sybase ASA Developer Version 8
Please reply only to the newsgroup

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs : http://downloads.sybase.com/swd/base.do
-> Choose SQL Anywhere Studio
-> Set filter to "Display ALL platforms IN ALL MONTHS"

<Herman Miller> wrote in message news:470d3768.19d4.1681692777@sybase.com...
> How can I pass the current user info into a stored
> procedured? What is the name of the function? I am
> attempting to use integrated security in a reporting package
> and need to restrict the user to see only their data.


Herman Miller Posted on 2007-10-11 09:29:48.0Z
Sender: 2599.470deb4a.1804289383@sybase.com
From: Herman Miller
Newsgroups: ianywhere.public.general
Subject: Re: Current User - found it
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <470ded0c.25b4.1681692777@sybase.com>
References: <470d3768.19d4.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 11 Oct 2007 02:29:48 -0700
X-Trace: forums-1-dub 1192094988 10.22.241.41 (11 Oct 2007 02:29:48 -0700)
X-Original-Trace: 11 Oct 2007 02:29:48 -0700, 10.22.241.41
Lines: 5
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6397
Article PK: 4739


> How can I pass the current user info into a stored
> procedured? What is the name of the function? I am
> attempting to use integrated security in a reporting
> package and need to restrict the user to see only their
> data.