Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End User permissions

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #183665
    chrisburton
    Participant

    I have a table setup strictly for user permissions (or roles, if you will) that will determine specific features within a comment system. I’m not particularly sure how I should setup the columns, however. For example, should I apply the user roles with numeric values or a string?

    // Admin
    role = 1 
    
    // User
    role = 2
    
    Banned
    role = 3
    
    // OR (self explanatory)
    
    role = 'admin'
    role = 'user'
    role = 'banned'
    

    Therefore, I could do something like:

    switch ($permission) {
        case 'admin': 
            $role = 'admin';
        break;
        case 'banned':
            $role = 'banned';
        break;
        default 'user':
            $role = 'user';
        break;
    }
    

    `

    #183666
    chrisburton
    Participant

    I think I answered my own question.

    #183774
    chrisburton
    Participant

    The switch statement is redundant though

    Thanks for the feedback, Ben.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.