SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict aniltc's Avatar
    Join Date
    Nov 2006
    Location
    INDIA
    Posts
    399
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    user management-role using mysql

    can any one help me to create a user management and role table in mysql.

    what I need, I would like to apply add/edit/delete/view permisson for a login users as well as group level users.


    group level users are architect,enigners etc (these are different types of users)
    these users are also login users ( I mean they are registered) . so while acessing some pages in my site i should give a add/edit/delete/view permisson for login users as well as groep level users. How can i achieve this ? how the table structure looks? please help me


    Thanks

  2. #2
    SitePoint Wizard PHPycho's Avatar
    Join Date
    Dec 2005
    Posts
    1,201
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Simple solution makes a use of following tables:

    Code:
    ---------------------------------------------------------
    users
    ---------------------------------------------------------
    id | group_id | username | email | password | status ....
    ---------------------------------------------------------
    Code:
    ----------------------------------------------
    groups
    ----------------------------------------------
    id | group_name
    ----------------------------------------------
    Code:
    --------------------------------------------------------------------
    group_permissions
    --------------------------------------------------------------------
    id | group_id | page_key | can_edit | can_delete | can_view | can_add
    --------------------------------------------------------------------
    Note: page_key are the values of the pages where you want to check the permissions.
    can_* are the boolean values ie they can have 0 or 1 values.

    In PHP you can check like this:

    PHP Code:
    if (hasPermission($page_key$action){
        
    //perform action ie can_*
    }else{
        
    //redirect to access denied page


    Hope this helps.


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
  •