Application Access Levels with PHP

Hello all

This week we got a job in to write an intranet site for a large Insurance company in the UK.

It had 60 or so applications that needed writing with access to each being given on a per user basis.

So for example user “A” could see applications 1 and 3, and user B could only use application 2.

So how do you do this easily?

We started off having a link table, it had User ‘A’ mapped to application 1 and so on. Which is ok but they have 5000+ staff and 60 applications so that would be a table with 300,000 rows in it, which in its self in MySql is nothing really, it just seemed excessive.

What we came up with is a bitwise solution so each application had a bit assigned to it. So if you remember your binary “0 1 2 4” etc. Each application was assigned a binary number, so application 1 was “1” in binary, application 2 was “10” ,application 3 was “100” and so on

So if a user as an access level of 7, that would translate in to a binary number of 111 so they could access application 1, 2 and 3. If a user had an access level of 4 for example they could only access application 3.

Binary (Base 2) Application
0 Superuser
1 Application 1
2 Application 2
4 Application 3
8 Application 4

We will post the class over the next few weeks if any body else wants to use it.

Happy coding

8 Responses to “Application Access Levels with PHP”

  1. Chantelle Says:

    hello…

    really good article. Ready to hear more next week,my blog http://www.datingdar.com/profile_blog.php Many Thanks….

  2. Benzing Says:

    really good article…

    I have spent a bit of time going through your posts, more than I should have but I must say, its worth it! http://dress071.freeblog.hu/ many Thanks….

  3. Ehantelle Says:

    hello…

    Hi there thanks for the quality post! http://paula11.tabulas.com/ ,i’d a good read.appreciate your article,My problem continues to be resolved….

  4. Kugenie Says:

    very helpful…

    I preferred to thank you for this good article. http://wxzal.wordpress.com/ I by all odds liked every little bit of it…

  5. Matilde Says:

    Great…

    You did a great job! http://daysi.musicblog.fr/2348319/kinny-again-Crystal-Renn/...

  6. sander Says:

    quality post…

    I have spent a bit of time going through your posts! http://dena.bloglion.com/2011/06/19/burberry-reside-stream-spring-2012-mens/ ,i had a good read….

  7. Cander Says:

    Great One…

    I must say, its worth it! My link, http://burnett.sier.no/,thanks haha…

  8. Frederic Says:

    very helpful…

    I preferred to thank you for this good article. http://lychtb.mylivepage.com/blog/1958/12062 I by all odds liked every little bit of it…

Leave a Reply

You must be logged in to post a comment.