Home » Developer & Programmer » Forms » User Privileges (merged 4) (Forms 6i)
User Privileges (merged 4) [message #509489] Sat, 28 May 2011 09:00 Go to next message
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 #509495 is a reply to message #509489] Sat, 28 May 2011 09:48 Go to previous messageGo to next message
Michel Cadot
Messages: 68678
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
GRANT

Regards
Michel
Re: User Privileges (merged 4) [message #509574 is a reply to message #509495] Mon, 30 May 2011 01:30 Go to previous messageGo to next message
mrnaveed
Messages: 74
Registered: December 2009
Location: Pakistan
Member
Its fine tutorial to create roles but i want to ask you that how to create permission on form level can you give me some example??
Re: User Privileges (merged 4) [message #510464 is a reply to message #509574] Mon, 06 June 2011 02:51 Go to previous messageGo to next message
mrnaveed
Messages: 74
Registered: December 2009
Location: Pakistan
Member
can any one give me coding example of user rights considering two forms.
Re: User Privileges (merged 4) [message #510467 is a reply to message #510464] Mon, 06 June 2011 03:00 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'm not sure I understood the question. Could you explain it once again, please? Provide as many details as possible.
Re: User Privileges (merged 4) [message #510475 is a reply to message #510467] Mon, 06 June 2011 03:29 Go to previous messageGo to next message
mrnaveed
Messages: 74
Registered: December 2009
Location: Pakistan
Member
I mean i have develop a project and want to control user access like which user wold be able to add and which user will be able to edit,delete.
Re: User Privileges (merged 4) [message #510478 is a reply to message #510475] Mon, 06 June 2011 03:34 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK. So what's wrong with GRANT Michel suggested a few days ago?

Owner owns tables and data stored within.
Create additional users.
Owner should grant privileges to other users - it is you who should decide which privileges, on what objects, are to be granted to which users.
Each of them (users) would suffer from INSUFFICIENT PRIVILEGES error when trying to perform operations he/she is not allowed to.
Re: User Privileges (merged 4) [message #510483 is a reply to message #510478] Mon, 06 June 2011 03:43 Go to previous messageGo to next message
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 #510484 is a reply to message #510483] Mon, 06 June 2011 03:47 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You'd put GRANT and REVOKE behind those checkboxes, and call them depending on whether the checkbox was checked (GRANT) or unchecked (REVOKE).
Re: User Privileges (merged 4) [message #510486 is a reply to message #510484] Mon, 06 June 2011 03:50 Go to previous messageGo to next message
mrnaveed
Messages: 74
Registered: December 2009
Location: Pakistan
Member
Sorry i didn't understand can you please give me some example or a form with some privileges coding example.

It would be your kindness.
Re: User Privileges (merged 4) [message #510506 is a reply to message #510486] Mon, 06 June 2011 04:43 Go to previous messageGo to next message
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/

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, issue
select 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?)

Re: User Privileges (merged 4) [message #510540 is a reply to message #510506] Mon, 06 June 2011 07:06 Go to previous messageGo to next message
mrnaveed
Messages: 74
Registered: December 2009
Location: Pakistan
Member
Thanks for your reply i am trying to do something similar like the example you provided but
In .NET i have a user creation form which have two text boxes and four check boxes

1.User Name(Text box)
2.Password(Password Text box)
3.Red(Check Box) has Boolean value true/false
4.Write(Check Box)has Boolean value true/false
5.Delete(Check Box)has Boolean value true/false
6.Edit(Check Box)has Boolean value true/false
7.Save
8.Exit


When i enter the user name and password and check the check boxes to grant permission these entries are saved in database table users.
Then i log in user using my log in form here i defined a global variable in module and call it on every for to check weather the user has permission to access the forms or not.

I want to achieve some thing like this i have attach the screen shot of my user creation form and log in form./forum/fa/9066/0/

Please it would be your kindness if you attach the .fmb file which elaborate the process of permission.
Thanks for your great help in advance.
  • Attachment: User.JPG
    (Size: 39.33KB, Downloaded 1211 times)
Re: User Privileges (merged 4) [message #511211 is a reply to message #510540] Fri, 10 June 2011 03:07 Go to previous message
mrnaveed
Messages: 74
Registered: December 2009
Location: Pakistan
Member
Please have look on my last post
Previous Topic: Email from oracle Form
Next Topic: Getting Error while creating a New User
Goto Forum:
  


Current Time: Thu Sep 12 09:03:39 CDT 2024