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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:26:45+00:00 2026-05-12T06:26:45+00:00

I’m trying to come up with a good way to do authentication and authorization.

  • 0

I’m trying to come up with a good way to do authentication and authorization. Here is what I have. Comments are welcome and what I am hoping for.

I have php on a mac server.
I have Microsoft AD for user accounts.

I am using LDAP to query the AD when the user logs in to the Intranet.

My design question concerns what to do with that AD information. It was suggested by a co-worker to use a naming convention in the AD to avoid an intermediary database. For example, I have a webpage, personnel_payroll.php. I get the url and with the URL and the AD user query the AD for the group personnel_payroll. If the logged in user is in that group they are authorized to view the page. I would have to have a group for every page or at least user domain users for the generic authentication.

It gets more tricky with controls on a page. For example, say there is a button on a page or a grid, only managers can see this. I would need personnel_payroll_myButton as a group in my AD. If the user is in that group, they get the button. I could have many groups if a page had several different levels of authorizations.

Yes, my AD would be huge, but if I don’t do this something else will, whether it is MySQL (or some other db), a text file, the httpd.conf, etc.

I would have a generic php funciton IsAuthorized for the various items that passes the url or control name and the authenticated user.

Is there something inherently wrong with using a naming convention for security like this and using the AD as that repository? I have to keep is somewhere. Why not AD?

Thank you for comments.

EDIT: Do you think this scheme would result in super slow pages because of the LDAP calls?

EDIT: I cannot be the first person to ever think of this. Any thoughts on this are appreciated.

EDIT: Thank you to everyone. I am sorry that I could not give you all more points for answering. I had to choose one.

  • 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-12T06:26:45+00:00Added an answer on May 12, 2026 at 6:26 am

    I wonder if there might be a different way of expressing and storing the permissions that would work more cleanly and efficiently.

    Most applications are divided into functional areas or roles, and permissions are assigned based on those [broad] areas, as opposed to per-page permissions. So for example, you might have permissions like:

    • UseApplication
    • CreateUser
    • ResetOtherUserPassword
    • ViewPayrollData
    • ModifyPayrollData

    Or with roles, you could have:

    • ApplicationUser
    • ApplicationAdmin
    • PayrollAdmin

    It is likely that the roles (and possibly the per-functionality permissions) may already map to data stored in Active Directory, such as existing AD Groups/Roles. And if it doesn’t, it will still be a lot easier to maintain than per-page permissions. The permissions can be maintained as user groups (a user is either in a group, so has the permission, or isn’t), or alternately as a custom attribute:

    dn: cn=John Doe,dc=example,dc=com
    objectClass: top
    objectClass: person
    objectClass: webAppUser
    cn: John Doe
    givenName: John
    ...
    myApplicationPermission: UseApplication
    myApplicationPermission: ViewPayrollData
    

    This has the advantage that the schema changes are minimal. If you use groups, AD (and every other LDAP server on the planet) already has that functionality, and if you use a custom attribute like this, only a single attribute (and presumably an objectClass, webAppUser in the above example) would need to be added.

    Next, you need to decide how to use the data. One possibility would be to check the user’s permissions (find out what groups they are in, or what permissions they have been granted) when they log in and store them on the webserver-side in their session. This has the problem that permissions changes only take effect at user-login time and not immediately. If you don’t expect permissions to change very often (or while a user is concurrently using the system) this is probably a reasonable way to go. There are variations of this, such as reloading the user’s permissions after a certain amount of time has elapsed.

    Another possibility, but with more serious (negative) performance implications is to check permissions as needed. In this case you end up hitting the AD server more frequently, causing increased load (both on the web server and AD server), increased network traffic, and higher latency/request times. But you can be sure that the permissions are always up-to-date.

    If you still think that it would be useful to have individual pages and buttons names as part of the permissions check, you could have a global “map” of page/button => permission, and do all of your permissions lookups through that. Something (completely un-tested, and mostly pseudocode):

    $permMap = array(
        "personnel_payroll" => "ViewPayroll",
        "personnel_payroll_myButton" => "EditPayroll",
        ...
    );
    
    function check_permission($elementName) {
        $permissionName = $permMap[$elementName];
        return isUserInLdapGroup($user,$permissionName);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

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.