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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:57:27+00:00 2026-05-13T13:57:27+00:00

I am just about to undertake building a relatively large PHP system, I just

  • 0

I am just about to undertake building a relatively large PHP system, I just need some ideas on how to implement a certain feature.

I will allow users to register. Once registered, the user will have a security level which will be assigned to their account.

So if I had security levels 1, 2 and 3, what would be the best way to show certain things to people with certain security levels ?

Thank you 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. Editorial Team
    Editorial Team
    2026-05-13T13:57:28+00:00Added an answer on May 13, 2026 at 1:57 pm

    Pekka’s comments about looking at the Zend API’s are good. Many of the Frameworks for PHP are currently (sadly) badly implemented junk (with hideously amateur code underneath), but the Zend API’s are almost uniquely valuable.

    If you do roll your own, which there is nothing wrong with doing if you can’t find something that fits what you want (and can’t be extended easily), then I’d take an OO approach and expose user properties via a class.

    e.g.

    $user = new User($session->userId);
    if (!$user->isAdministrator && !$user->canViewReports)
        someErrorHandler("You do not have permission to access this content.");
    

    I’d avoid having fixed levels, but instead follow a roles based approach.

    i.e. I’d avoid having levels like:

    • Staff
    • Manager
    • Administrator

    And instead I’d go for properties (just as illustrative examples):

    • read_access
    • write_access
    • can_view_logs
    • can_view_reports
    • is_administrator

    This allows you to be easily more explicit later, when you (inevitably) discover you want an additional permissions group you want have to go back and change existing code.

    That doesn’t mean putting users in groups is a bad idea (it’s not and you could implement this using a groups system, e.g. where by a user could be in both “Reporting” and “Logs”), but assumptions about security levels being hierarchical are typically the wrong approach (e.g. Level 1=Staff, Level 2=Managers, Level 3=Admin) – this is because you almost always end up needing a system that’s more flexible than a simple hierarchical system allows.

    In practice if you do end up taking this approach, you may want to have a Permissions or Group class, to avoid having an overly large User class (which might end up full of stuff for getting user properties, setting new passwords, etc).

    e.g.

    $group = new Group($session->userId);
    if (!$group->Administrators && !$group->Reporting)
        someErrorHandler("You do not have permission to access this content.");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just about every piece of example code everywhere omits error handling (because it confuses
I'm just about to make my first trip into the world of JNI (Java
I'm just about wrapped up on a project where I was using a commercial
I've gone through just about every property I can think of, but haven't found
I use log4net in just about every code project. I was wondering what other
i was just about to finish up my project and install it as a
So here I am just about to start a big project using LINQ to
In a C++ application that can use just about any relational database, what would
I'm working on a project which is just about to start, and since I
I think you can do GDI+ drawing in just about any window in a

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.