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

We are just about to implement full blown TFS 2008 across our development team
I've tried just about every locator, and none of them will detect an element
I'm about to undertake a .NET project: We need to create a create a
I'm just about to start a small mobile site that will be written in
I have this code...that does just about exactly what I need it to. It
I'm working on an app that displays a large image just about the same
PHP has this wonderful function, strtotime , that takes any string containing just about
Hi just about to get the dev team to start looking at the next
I am just about done writing a killer application for the mac, however I
I'm just about getting into WCF ; but from what I've read so far,

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.