0

I'm writing a simple web application that allows users to login on different levels. Example:

  • admin: may access to everything in read/write
  • manager: some sections are in read/only
  • operator: only few sections available

I'm using CakePHP, by the way. As far as I understand there two main approaches to handle such a different UI interactions:

  1. on login, redirect the controllers to different prefixes (i.e. /admin, /manager, etc...).

  2. on login, set a variable to store the current user level and add conditional instructions where needed

I'm not asking what is better (that would be just an opinion) but when it's desirable to use one and when the other approach.

My thoughts: the first way should be used when you have a lot of different things to handle. It would be acceptable to create copies of Pages and Controllers because you can better customize each one.

On the other hand, if you just need to hide or disable a couple of buttons it would easier to maintain a single copy of the files and live with some if.

  • 1
    What happens if I go to /admin directly in the browser location bar when I am a manager? – Greg Burghardt May 9 at 22:47
  • @GregBurghardt: An error page is shown, telling you're not logged in – Mark May 10 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.