/    Sign up×
Community /Pin to ProfileBookmark

Admin User Levels

I’m looking to have a admin-user table, I’ve done this plenty of times before with user levels 1,2,3,4 and 5 etc.

However the current project has (so far) 5 different functions with the requirement to add more.

Each user will be given differnet combination of permissions.

Two solutions could be

  • 1. In my admin-users table, have a column for each function and have 1 or 0. I don’t like this as it will require consistant table changing.

  • 2. Have a admin-funcations table and a table linking users and functions together. It’s just messy.
  • Are there any other ways of doing this. Do recall in a .net project from 5-10 years ago using a single column for the permissions. By memory ininteger as there are 32 bits. You assigned each bit to a function.

    Could this be done in MySQL and PHP?

    to post a comment

    4 Comments(s)

    Copy linkTweet thisAlerts:
    @kiwisauthorAug 06.2020 — So I guess I'm asking for the oppersite to "role based" persmissions.
    Copy linkTweet thisAlerts:
    @NogDogAug 06.2020 — > @kiwis80#1621840 Have a admin-funcations table and a table linking users and functions together. It's just messy

    Probably the "right" way to do it in a relational database world. In the long run probably easier to maintain over time, as (a) it's pretty clear to see who has what permissions, and (b) it's easy to add new permissions when needed. But whether it's worth the bit of extra work to initially set it up, only you can answer.
    Copy linkTweet thisAlerts:
    @NogDogAug 06.2020 — > @kiwis80#1621840 You assigned each bit to a function

    You could do it like Linux file permissions, using powers of 2: 1 = X, 2, = Y, 4 = Z, etc.; so 7 would have all 3, 6 would have Y and Z, etc.
    Copy linkTweet thisAlerts:
    @VITSUSAAug 07.2020 — @kiwis80#1621840 I agree with NogDaog, (i) it needs to be clear to see who has what permissions, and (ii) it's easy to add new permissions when required. But whether it's worth the bit of extra work to initially set it up, only you can answer.
    ×

    Success!

    Help @kiwis spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 4.25,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...