Closed Thread
Results 1 to 9 of 9

Thread: how to do a good rights management

  1. #1
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    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..

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Jordan Guest

    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.

  4. #3
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    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.

  5. #4
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    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.

  6. #5
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    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?
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  7. #6
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    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.

  8. #7
    Join Date
    May 2008
    Posts
    2,126
    Blog Entries
    1
    Rep Power
    33

    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.

  9. #8
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    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.

  10. #9
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: how to do a good rights management

    Perhaps a bit-string to store the permission/denial values.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How/Where might i buy rights to a 2d mmorpg
    By atheium in forum General Programming
    Replies: 2
    Last Post: 06-24-2011, 02:33 AM
  2. show menu items on vb.net application based on user rights
    By yonghan in forum Visual Basic Programming
    Replies: 7
    Last Post: 01-18-2010, 10:53 AM
  3. Document Rights Mangement
    By engr in forum ASP, ASP.NET and Coldfusion
    Replies: 17
    Last Post: 08-06-2009, 02:59 AM
  4. Rights of a Blogger
    By Chinmoy in forum The Lounge
    Replies: 3
    Last Post: 06-01-2009, 01:43 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts