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 113763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:45:13+00:00 2026-05-11T02:45:13+00:00

I am part of a team creating a web application using PHP and MySQL.

  • 0

I am part of a team creating a web application using PHP and MySQL. The application will have multiple users with different roles. The application will also be used in a geographically distributed manner.

Accordingly we need to create an access control system that controls user permissions for specific database records i.e. modifies database queries so that only specific records are displayed. For example, for a user at the city level, only those records should be displayed that relate to the user’s particular city, while for a user at the national level, records for ALL CITIES in the country should be displayed.

I need help on designing a system that can handle this type of information retrieval without hardcoding the information in the SQL queries.

Any help would be appreciated.

Thanks in advance

  • 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. 2026-05-11T02:45:14+00:00Added an answer on May 11, 2026 at 2:45 am

    The design of the application will vary based on the required security needs.

    For example, is information stored across multiple databases or in a single database? Is it important to present each TYPE of user with a schema of the database that represents their particular permissions? Obviously the answers to these questions suggests whether you need a more secure system for database access or not.

    If you do, then create a database user for each type of user that will exist in the system. Provide each user with permissions to the appropriate tables, views, procedures, etc. When a user authenticates to the system, you’ll have to create a conditional database connection based on the user type for that person.

    To take the furthest extreme, it can also be appropriate to control access to the database strictly through stored procedures. Then each database user would only have access to their needed set of stored procedures.

    Implementing security in the database can be pain and increases the complexity of the application as well as the cost of maintaining it and does decrease overall cohesion in the application IMO but it also presents a very tight security wall to anyone who might want to hack or otherwise abuse the system.

    Regardless of what you implement within the database for security purposes, you will also obviously need to use a session mechanism to store the currently authenticated user and their type. An easy way to change functionality for a particular user is to encapsulate each user’s available actions (read functions or methods) and their attributes (or properties) within a class to represent the specific user. That way if two people hit Dashboard.php, they will see precisely the data that they have access to.

    Lastly, you can control some of the access controls (and likely will have to) through information stored about the user in the database such as what cities they need to see information for or what user’s they supervise. Then use that information to create collections of objects that can be accessed from your user-specific domain objects.

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

Sidebar

Ask A Question

Stats

  • Questions 70k
  • Answers 71k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Switch statements are very rarely necessary in Javascript. In general,… May 11, 2026 at 1:08 pm
  • added an answer Having looked at the docs, like you suspected, models.DateField doesn't… May 11, 2026 at 1:08 pm
  • added an answer See 'netdevice', through man netdevice or on the web. SIOCGIFCONF… May 11, 2026 at 1:08 pm

Related Questions

No related questions found

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.