Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-08-2008, 07:42 PM
orjan's Avatar   
orjan orjan is offline
Programming Professional
 
Join Date: Sep 2007
Location: Sunne, Värmland, Sweden
Age: 33
Posts: 328
Last Blog:
Procedural Programming...
Rep Power: 9
orjan has a spectacular aura aboutorjan has a spectacular aura aboutorjan has a spectacular aura about
Default how to do a good rights management

Hello there!

I'm currently working on an web application
and now I've made the login and registration part and it works great.
now I been thinking for a pretty long time how to make a good rights management part

how do I best store rights in a database?

one thing I've tried has been a string pipeseparared, with values of different rights, with a specific right on a predefined position, but it's hard to manage

before I've saved rights codes in a table, one row for each right to each user and created an rights array from there.

now I'm thinking of these systems and think if this any good at all.

the rights would probably be static, so each rights would be on or off, I don't think I'd lay several levels of rights onto one right, or what can you need?

it needs to be dynamically though, so if I set up a new module into the application, I need to assign new rights for that module...

much to think of, anyone having another solution, or thaugts on my previously used right managements?

the system needs to be easy to handle both in reading from database and easy to update in great sets from the coming admin panel.

I will probably need to set up a list of possible rights too, so the admin panel can read out of a list how to know what to let control or not..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-09-2008, 08:34 AM
Jordan's Avatar   
Jordan Jordan is offline
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 9,199
Last Blog:
Ext JS or Ext GWT
Rep Power: 20
Jordan is just really niceJordan is just really niceJordan is just really niceJordan is just really nice
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default Re: how to do a good rights management

If you do not want to store each one in a separate column, each right that is, you can use the serialize and unserialize functions of PHP do basically do what you described earlier.

Serialize:
Returns a string containing a byte-stream representation of value that can be stored anywhere.

Unserialize
unserialize() takes a single serialized variable and converts it back into a PHP value.


How many rights are there? If it were me I'd make a new table using the ID (which would link back to the user and be the identifier) and have a new column for each right. The right would contain an integer value of 0 or 1.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
The CodeCall Wiki is now fully integrated with vBulletin users! Check it out and add some new pages!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-09-2008, 12:14 PM
orjan's Avatar   
orjan orjan is offline
Programming Professional
 
Join Date: Sep 2007
Location: Sunne, Värmland, Sweden
Age: 33
Posts: 328
Last Blog:
Procedural Programming...
Rep Power: 9
orjan has a spectacular aura aboutorjan has a spectacular aura aboutorjan has a spectacular aura about
Default Re: how to do a good rights management

the problem is that I will have more rights to set for each module added, so I can't have it column based, as I don't want a new module to change the base data structure, only the data structure it self will need in case of tables and so.

it might be everything from 5 to 500 different rights all depending of how many modules are added in the future...

I will look into the Serialize thingie and see what that gives.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-26-2008, 05:12 PM
orjan's Avatar   
orjan orjan is offline
Programming Professional
 
Join Date: Sep 2007
Location: Sunne, Värmland, Sweden
Age: 33
Posts: 328
Last Blog:
Procedural Programming...
Rep Power: 9
orjan has a spectacular aura aboutorjan has a spectacular aura aboutorjan has a spectacular aura about
Default Re: how to do a good rights management

yepp, Im bumping this thread, as I can't find a good solution on this by my self, and hope that anyone out there might have an advice for me.

I at the moment feel like I can't run further with the system I'm writing, before I know how to handle the rights part, as it is rather important and decisive for the future of the framework I'm writing.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-26-2008, 05:28 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,266
Last Blog:
wxWidgets is NOT code ...
Rep Power: 36
WingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to all
Default Re: how to do a good rights management

The real question is this:
Can you define a few basic levels, or does it have to be on a per-user basis?
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 08-27-2008, 08:15 AM
orjan's Avatar   
orjan orjan is offline
Programming Professional
 
Join Date: Sep 2007
Location: Sunne, Värmland, Sweden
Age: 33
Posts: 328
Last Blog:
Procedural Programming...
Rep Power: 9
orjan has a spectacular aura aboutorjan has a spectacular aura aboutorjan has a spectacular aura about
Default Re: how to do a good rights management

it really have to be on a per-user level, so everyone could have a special setup of rights, except for a few admins who shall have it all.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 08-27-2008, 08:18 AM
MeTh0Dz|Reb0rn's Avatar   
MeTh0Dz|Reb0rn MeTh0Dz|Reb0rn is offline
My Posts Are Moderated
 
Join Date: Jul 2008
Posts: 13
Rep Power: 0
MeTh0Dz|Reb0rn is an unknown quantity at this point
Default Re: how to do a good rights management

If it were me and I had to do it that way. I'd make a structure of rules, and then for each user just save that structure in a database.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 08-27-2008, 08:26 AM
orjan's Avatar   
orjan orjan is offline
Programming Professional
 
Join Date: Sep 2007
Location: Sunne, Värmland, Sweden
Age: 33
Posts: 328
Last Blog:
Procedural Programming...
Rep Power: 9
orjan has a spectacular aura aboutorjan has a spectacular aura aboutorjan has a spectacular aura about
Default Re: how to do a good rights management

yes, that is the question, how to do a working structure and storage of it, both easy to read, write and modify from my code?

is it better to make boolean rights for each use, or should i make fewer with a certain level?
like:

booean type generates this kinda rights:
read page A
modify page A
alter page A
whatever page A

or the level based of
Page A: read, modify, admin etc with increasing rights...

the first one take more out of the db, with storage and looping etc,
but is really simpler to work with, I guess?

or the second way which is easier with the db, but would need more logic in the code
to interpret the rules.

and, if you go with boolean type, should I store all rights with true or false, or just the set ones? what would be easiest? what would be better in a coding example, how to check if a right is ok or not etc?

it's many questions, ofcourse some, Ieed to just decide much depending on my code, but it is still a few ways to go depending on what makes logical and usable.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 08-27-2008, 11:49 AM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,266
Last Blog:
wxWidgets is NOT code ...
Rep Power: 36
WingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to all
Default Re: how to do a good rights management

Perhaps a bit-string to store the permission/denial values.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[WTS] Webmaster Blog - Unique content - Good Rev - Good Price! Talks_44 Sites for Sale 5 07-14-2008 01:32 PM
Good evening Toby Introductions 4 05-03-2007 12:56 PM
Using change management Cosmet General Programming 2 10-30-2006 07:16 PM


All times are GMT -5. The time now is 02:33 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads