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

  • Home
  • SEARCH
  • 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 924385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:20:40+00:00 2026-05-15T19:20:40+00:00

I have a PHP MySQL application which has a modular design. There are about

  • 0

I have a PHP MySQL application which has a modular design. There are about 5 modules total now, and I don’t really foresee there ever being more than 10.

I currently have 2 types of users – “User and Admin”. These user types have the same perms except the Admins can edit users, whereas regular users can’t.

I want to implement modular permssions, such that if you are an Admin you have permissions to make changes in ALL modules. If you are a regular User, there will be a way to set which modules that user has access to (ie a set of checkmarks).

My question is, what is the best way to store this in the database? I already have a Users table. I’ve come up with the following 3 solutions right off the top of my head, I’m wondering if there is a recommended way to do it or if there are other ways. I also need to keep in mind that when upgrading the application to the new version, I will have to set up perms for all users currently in the DB. I also have to be able to easily add a default perm for each user when a new module is integrated. I’m looking for something easy to maintain and implement, but flexible for adding a few more modules.

My brainstormed options so far:

  1. Store perms in the Users table in a column with a bit-mask type of string: 10001 indicates they have permissions for “Module A” and “Module E” only.
  2. Store perms in the Users table in a column with a delimited (comma or pipe) list of module names which the user has perms for: “ModuleA,ModuleE”.
  3. Create a separate table for user perms like so:
UserId  | Module  | Permission
1       | A       | 1
1       | B       | 0

What do you think?

  • 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-15T19:20:41+00:00Added an answer on May 15, 2026 at 7:20 pm

    It sounds like you are only tracking access as opposed to granular permissions which is fine.

    Store perms in the Users table in a column with a bit-mask type of string: 10001 indicates they have permissions for “Module A” and “Module E” only.

    I would highly recommend against this. Bit masks in databases are a maintenance nightmare. It is not even remotely obvious to another developer what the meaning of each of the bits represent.

    Store perms in the Users table in a column with a delimited (comma or pipe) list of module names which the user has perms for: “ModuleA,ModuleE”.

    This is a variant on your first solution only using a delimiter. Again, I would highly recommend against it as it is a maintenance headache.

    Create a separate table for user perms like so:

    This is the solution I would recommend. The big reason is that it is more extensible than the others and is easier to maintain. If you wanted to make a maintenance screen to control permissions, it would be trivial using this approach. You can easily add modules, change the order of the modules and later expand on what is maintained in the table (e.g. you might later add “Read Only” as a column as different than the ability to simply access the module). In addition, this approach makes it easier to pull information from the table. “Who has access to module X?” is an easy query to write with this, it is harder using a delimited list or bit mask.

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

Sidebar

Ask A Question

Stats

  • Questions 523k
  • Answers 523k
  • 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 Here is a working example. First we create a slider… May 16, 2026 at 9:44 pm
  • Editorial Team
    Editorial Team added an answer Here is an example of Pekka's suggestion: $currFile->addValidator('Extension', false, 'png,jpg')… May 16, 2026 at 9:44 pm
  • Editorial Team
    Editorial Team added an answer Check the $? variable after executing a command. If everything… May 16, 2026 at 9: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

Related Questions

We have a php/mysql based application which has slightly different instances for a number
As the title suggests, I've inherited a php/MySQL application which has fairly well written
I have a PHP web application which uses a MySQL database for object tagging,
I have a mysql question. I have an application which I am migrating to
We have a web application which has been developed over the past 7 months.
I have kind of Listing application for iPhone application, which always calling a web
I am creating an application, built with PHP, MySQL and Doctrine v1.2, that deals
I am making an auction website, which has an auto-bid system. This system lets
I have recently written a socket server in PHP that will be handling communication
I have a application.ini like this [production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 includePaths.library

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.