If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Database design with role and function

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-08-11, 08:22
rajkhowa123 rajkhowa123 is offline
Registered User
 
Join Date: Mar 2011
Posts: 2
Database design with role and function

The system I am developing has users with roles like entry, verify and approve. Each of these roles has different functions assigned to them. For example role entry has ApplicationEntry and ApplicationSearch functions, verify has AplicationVerify function ..and like that. When a user is asigned a role, he gets all the functions defined for that role. To handle this scenario, I have a user_role lookup table and a role_function lookup table.

Now sometimes this mapping need to be bypassed i.e. a user need to be assigned a function that belong to a different role. This is rare but should be present in the system. How can I implement this functionality without affecting the existing mapping? Thanks for any suggestion.
Reply With Quote
  #2 (permalink)  
Old 03-08-11, 10:01
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
Create another role that encompasses the additional functions you need. Place your target user in both roles. Say you want to grant search for one specific area but don't want to give a user ALL of ApplicationSearch, create a "MySpecificSearchArea" role and assign the user to that instead. Then check if user has EITHER role when they attempt to look at MySpecificSearchArea.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #3 (permalink)  
Old 03-09-11, 05:24
rajkhowa123 rajkhowa123 is offline
Registered User
 
Join Date: Mar 2011
Posts: 2
Hi Teddy.thanks for the reply.

Quote:
Originally Posted by Teddy View Post
create a "MySpecificSearchArea" role and assign the user to that instead. Then check if user has EITHER role when they attempt to look at MySpecificSearchArea.
In that way I will have to create a new role everytime I need to bypass the mapping for a user. This system will be used in diferent offices and each office might choose to bypass the mapping in diferent ways. Say in one office one user having the Entry role might be assigned some functions of the Approve role. In another office one user having the Verify role might be assigned some functions of the Entry role. It is also possible after some time the extra functions can be taken back from that user.

So I would prefer to implement it in the database level without having to change any code.
Reply With Quote
  #4 (permalink)  
Old 03-09-11, 09:13
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
Create a stand-alone role for each function. Assign users to functions as needed. If you want to get fancy you could allow roles to belong to roles. That makes the app code and data structure a lot more complex in exchange for the ability to create "custom" roles comprised of any number of functions without needing to change the code.

You'll probably get by just fine breaking out each "function" as a role and assigning them individually though. You can always charge extra if someone wants to create their own composite roles. ;o)
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On