Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Implementing row-level security.

Re: Implementing row-level security.

From: David Sisk <davesisk_at_ipass.net>
Date: Tue, 16 Jun 1998 02:57:25 GMT
Message-ID: <palh1.74$cn.3589179@news.ipass.net>


Hi. Look up the CONNECT BY... START WITH clause for SELECT. You will have to add the manager's employee number and the Oracle userid to the table, but once you do that, you can construct a view that adjusts it's contents based on who the currently signed in user is. (You'll need to write a simple function that returns the employee number when passed the userid. You can get the userid from the psuedocolumn USER.) Hope this helps,
Dave

Suwat Kan. wrote in message <01bd9792$85af00a0$d40e91cb_at_computer>...
>Dear Sir,
>
> I have a problem about implementing the row-level security. My situation
>is as follow :
>
>I have a table : EMP_SALARY
> (EMP_CODE VARCHAR2 (5),
> DEPT_CODE VARCHAR2 (10),
> SALARY NUMBER (8));
>
> data : 00001, ACCOUNT, 15000
> 00002, FINANCE, 12000
> 00003, FINANCE, 20000
> 00004, ACCOUNT, 18000
>
>I have 3 users : admin can select all data and own the table EMP_SALARY and
> grant the select privilege on table EMP_SALARY to user1 and user2
> user1 can select only data with dept_code = 'ACCOUNT' and
> own the synonym EMP_SALARY reference to ADMIN.EMP_SALARY
> user2 can select only data with dept_code = 'FINANCE' and
> own the synonym EMP_SALARY reference to ADMIN.EMP_SALARY
>
>The condition that I need is :
> If I login as user1, using the select statement : select * from
>emp_salary;
> the displayed data should be : 00001, ACCOUNT, 15000
> 00004, ACCOUNT, 18000
>
> And if I login as user2, using the select statement : select * from
>emp_salary;
> the displayed data should be : 00002, FINANCE, 12000
> 00003, FINANCE, 20000
>In the situation above, if I don't want to create view to filter the row
>for user1 and user2, is there any
>other options to achieve this task. If you have any suggestions, please
>mail to me,
>my e-mail address is : swkanj_at_asiaaccess.net.th
>
> Thank you very much for your help,
> Suwat Kanjanavathang
>
Received on Mon Jun 15 1998 - 21:57:25 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US