TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-17-2009, 09:47 AM   #1 (permalink)
The Wanderer
 
amitdgr's Avatar
 
Join Date: Mar 2009
Posts: 5
Thanks: 0
amitdgr is on a distinguished road
Default How do I design my access control system ?

Hey guys,

I am working on a small erp like application (based on PHP/MySQL). I need to implement RBAC system in the application.

What I need ...

1) The application needs to have users with around 5 different roles. Super Admin, National admin(diff. national admins for diff. countries), Zonal Admin, Sub-Zonal Admin, user.

2) The Super Admin can access and control everything.

3) A National admin can see users and access details that are local to his/her country, a zonal admin can see users and functions only under his/her zone and so on.

4) I also need to show different menus for different user roles.

What I thought might work....

1) One table will store user details, one will store role details, one will store location access details. We have to map these 3 tables to get the exact access level of the particular user. I really have no idea how to go about this.

2) For the menu, I will create 5 different menus for 5 different users and then show the particular menu depending on his role. Is this a good way to go about this ?

I am completely lost and confused. All my efforts so far have been fruitless.
amitdgr is offline  
Reply With Quote
Old 04-20-2009, 09:22 AM   #2 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
Thanks: 2
Jim is on a distinguished road
Default

I think your DB tables look pretty good.

For the menu (and all other places) i would implement something like:

PHP Code:
$currentUser = new user()->getUserBySession();

if(
$currentUser->hasAccess("edit-user"))
{
  
// Has XS
}
else
{
  
// Had no XS

__________________
Nunchaku! Who doesn't like martial arts? =)
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 04-21-2009, 04:46 AM   #3 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

Quote:
Originally Posted by Jim View Post
I think your DB tables look pretty good.

For the menu (and all other places) i would implement something like:

PHP Code:
$currentUser = new user()->getUserBySession();

if(
$currentUser->hasAccess("edit-user"))
{
  
// Has XS
}
else
{
  
// Had no XS

Oh Jim, just to be picky and boring as usual:
PHP Code:
$instance = new Object()->method(); 
Will result in a parse error ;)


As for the real question, Wildhoney gave a good idea about this in this thread:
Easy to Modify Login Script with Hierarchical User Permissions and XML Account File
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Old 04-21-2009, 07:28 AM   #4 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
Thanks: 2
Jim is on a distinguished road
Default

Damn, and i was just trying to be cool :P
__________________
Nunchaku! Who doesn't like martial arts? =)
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 04-21-2009, 09:21 AM   #5 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Quote:
As for the real question, Wildhoney gave a good idea about this in this thread:
Easy to Modify Login Script with Hierarchical User Permissions and XML Account File
I was going to suggest using a bit based permission system, ya beat me to it xD Good script from Wildhoney there (as always :))
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pagelite Pagination System ioan1k Show Off 3 01-29-2013 12:40 PM
Freelance Suite: Client & Project Management Software CLCook Show Off 2 09-14-2008 10:50 AM
Designing a tagging system Alan @ CIT Advanced PHP Programming 4 03-10-2008 03:25 PM
Need some advice in DB design DeMo MySQL & Databases 6 01-30-2008 12:32 AM
Building an Apache-like Access Control List (ACL) Wildhoney General 2 12-14-2007 02:03 PM


All times are GMT. The time now is 10:57 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design