Login with different user level

Hey guys,

I am new to Coldfusion so please forgive me for any silly questions.

I am making website where users will have different level of rights. There are pages that I want only Admin to view, there are pages that I want only Admin and Supplier to see and there are pages that every user can see.

My logic for this was I will have user_leve field in database (ie. 0 for normal user, 1 for supplier and 2 for Admin). On every page I will include little Authentication page (simple condition, allow if user_level is > 0 allow to view page, so supplier and Admin can view the page)

Now here is the issue, When user login successfully I want to set some variable values in application.cfm (like user name and user_level) so I can use them later on for authentication.

Big Question:

[LIST=1]
[*]How to set value in Application.cfm when user login?[/LIST]

  1. How to retrieve it when authentication?

Sorry, about the long message. Thanks for reading and your helps in advance.

You want to save them in the session scope if the details are specific to each user.

That will stay in memory for the length of the user’s time in the application, until their session times out ( maybe from being idle ) or you delete them in your code ( i.e. logout ).

Application.cfm is generally used for setting values which are specific to the application and unlikely to change i.e. database names, directory paths to files and general configuration settings.

Cheers,
James

I would suggest looking into cflogin and cfloginuser with Application.cfc (instead of cfm).

Currently have a similar system setup using that with all categories coming from the db (id, parent_id) with permissions on each category entry.