Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 816945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:54:59+00:00 2026-05-15T01:54:59+00:00

I’ve started developing a forum application in PHP on my MVC Framework and I’ve

  • 0

I’ve started developing a forum application in PHP on my MVC Framework and I’ve got to the stage where I assign permissions to members (for example: READ, WRITE, UPDATE, DELETE).

Now, I know I can add 5 columns under the user table in my database and set them to 1 | 0, but that to me seems like too much if I want to add other rules, like MOVE for example.

And how can I dynamically assign these privileges them to users individually?

I’ve heard of using a bitmasks, but it would be really good if I could fully understand them before I continue.

Do you have an example of how I might implement this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:54:59+00:00Added an answer on May 15, 2026 at 1:54 am

    The method you described — individual privileges stored in columns — is straightforward at the expense of flexibility (as you noticed).

    Zuul’s method is even more simple and essentially the same as yours, except it avoids the need for any “ALTER TABLE” statements. However, it is not normalized, not easily queryable and not self-documenting.

    Another problem with both of these methods is that as your user base grows, you will find it increasingly more of a pain to keep everybody’s privileges set properly. You will find yourself with a lot of users who need exactly the same privileges. Yet in order to change a user’s privileges, such as to accomodate a new privilege, you will have to go in and add that privilege to each user who needs it individually. Major PITA.

    For a forum, it’s not likely that you’ll need per-user privilege management. More likely you’ll have certain classes of users like anonymous users, logged-in users, moderators, administrators, etc. This would make it well-suited for role-based access control (RBAC). In this system you would assign each user to a role, and grant privileges to the role. Privileges would be stored as rows in a “privilege” table. so the simplified database schema would look like:

    PRIVILEGE
    int id (primary key)
    varchar description
    
    ROLE_PRIVILEGE_JOIN
    privilege_id (foreign key)
    role_id (foreign key)
    
    ROLE
    int id (primary key)
    varchar description
    
    USER
    int id (primary key)
    int role_id (foreign key)
    

    This pattern is used in many applications that deal with user privileges. Add every privilege that anyone could possibly have as a row in the privilege table; add every role that any user could possibly have in the role table; and link them appropriately in the role_privilege_join table.

    The only real disadvantage is that because a join table is used, the “can user X do Y” query is going to be somewhat slower.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 447k
  • Answers 448k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Although I very much like EOL's answer, I wanted to… May 15, 2026 at 7:44 pm
  • Editorial Team
    Editorial Team added an answer I think it should be a lot easier - (NSDate… May 15, 2026 at 7:44 pm
  • Editorial Team
    Editorial Team added an answer Someone report the same problem as a bug in the… May 15, 2026 at 7:44 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.