User Privileges (merged 4) [message #509489] |
Sat, 28 May 2011 09:00 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
mrnaveed
Messages: 74 Registered: December 2009 Location: Pakistan
|
Member |
|
|
Hi to all,
I hope you all would be fine
Can any one help me by providing some coding example how can i assign permissions to one user to add,delete,edit data and other user should be able to perform all functions or selected functions please help me by providing complete information.
|
|
|
|
|
|
|
|
|
Re: User Privileges (merged 4) [message #510483 is a reply to message #510478] |
Mon, 06 June 2011 03:43 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
mrnaveed
Messages: 74 Registered: December 2009 Location: Pakistan
|
Member |
|
|
Actually i have done user control access in .NET but i am little bit confused how to create a user rights forms?
I have create a module in vb.net and control access of user from this module, i have user creation form which have four check boxes like add,read,delete,edit.
How to achieve this goal in forms 10g.
|
|
|
|
|
Re: User Privileges (merged 4) [message #510506 is a reply to message #510486] |
Mon, 06 June 2011 04:43 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Quote:[.net]: i have user creation form which have four check boxes like add,read,delete,edit.
Do the same in Forms. WHEN-CHECKBOX-CHANGED trigger is to be used; GRANT and REVOKE syntax can be found in documentation. Here's an example: connected as user SCOTT, I created one table - its name is "TEST" and entered a few records in there. In Forms Builder, I created a form that contains several items: TABLE_NAME, USER_NAME (to who do I want to grant privileges (or revoke them from)), as well as SELECT / INSERT / UPDATE / DELETE checkboxes. This is how it looks like:
![/forum/fa/9064/0/](/forum/fa/9064/0/)
This is a trigger code:declare
l_str varchar2(300);
begin
if checkbox_checked('cb_select') then
l_str := 'grant select on ' || :table_name || ' to ' || :user_name;
else
l_str := 'revoke select on ' || :table_name || ' from ' || :user_name;
end if;
forms_ddl(l_str);
if not form_success then
message ('Operation failed');
else
message ('Operation succeeded');
end if;
end;
How to test whether it works or not? Go to SQL*Plus, connect as user MIKE. Before doing anything in a form, issueselect count(*) from scott.test; You'll get the ORA-00942 error (a table doesn't exist).
Run the form as SCOTT. Enter table name (test), user name (mike), check the SELECT checkbox.
Go back to SQL*Plus, run the same SELECT again - you'll get number of records.
Uncheck the checkbox and repeat SQL*Plus operation - ORA-00942 is back.
That's all, I guess.
(Though, if you already have a solution, written in .net, why do you need another one?)
|
|
|
|
|