SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    622
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    different privileges to different users

    hi all

    i creating a cms in which i need to give different privileges to different users who will be logging in and updating the content.

    a) 3 users should be able to only add content and not able to delete/modify any thing.

    b) 3 users should be able to modify/delete anything.

    what's the easy way of doing it.

    while showing every result row shall i show the delete/update button with "if statement".

    or can you suggest any other method ?

    vineet

  2. #2
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    622
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    no suggestions ?

  3. #3
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    One term you should be searching the web and this forum for is access control - it is usually achieved by setting an access flag in your user table and setting a session variable once a user has logged in.

    On each subsequent page request the access control level is checked vs this users level.

    Your situation sounds quite simple, some access control systems are complex - try searching simple PHP access control for some initial ideas.

    Once your cms has multiple applications you will likely then want to grant different levels depending on who/what level they have.

    simple example:
    Code:
    users
    ====
    id | name
    =======
    1 | Bob
    2 | Carol
    3 | Ted
    4 | Alice
    
    apps
    ====
    id | app
    ======
    1 | News
    2 | Blog
    
    users_apps
    =========
    user | app | level
    =============
    1  -  1  -  1 
    1  -  2  -  0
    2  -  1  -  0
    ie Bob has write access to News but read-only access to Blogs, whereas Carol has read-only rights to News and cannot even access Blog. Ted and Alice cannot access anything at all.

  4. #4
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    622
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    hi cups

    thanks for the suggestions

    vineet


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
  •