Solved

These pages is for Administrators only (My Application)

Posted on 2004-08-12
5
140 Views
Last Modified: 2013-12-24
Hello,

Please help restrict my Administrator pages (about 20 pages) from the rest of the other users.

I have my Access database with a table of users that includes a field for UserLevels.

if the UserLevel is 3 and above, that user should be able to access the 20 cfm pages available only for administrators.

Please I would like to request some code and where to put it.  Please be clear as possible.  It's the end of the week again and I have to come up with the login module by tommorow afternoon.  Please, I hope you understand.

Thanks in advance.

PS.  All users of my application will have to login.  But only Administratrs have the access to the Admin pages.

By the way, i use the basic session method in Ben forta's book.  So, those CFlogout, CFlogin is a bit different from what i am doing.
0
Comment
Question by:mdbbound
5 Comments
 
LVL 11

Accepted Solution

by:
hart earned 500 total points
ID: 11791358
ok how about this when the user logs in ..
and after u authenticate him with the database values...

create a session variable session.userlevel with the appropriate value

just put a if condition on top of the 20 files...

<cfif IsDefined(Session.UserLevel) And Session.UserLevel LT 3 ><!--- Not Admin user --->
   Show him some data saying no access to this page
   </cfabort>
</cfif>

now put this code in a common file that is UserAccess.cfm
and include this file in the top of the 20 files

Regards
Hart
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 11792010
i have a similar setup but access levels are different, i put my admin only pages in a separate forlder and have in my Application.cfm in the folder
<cfset localAccesLevel=100> <!--- administrative level --->
<cfset RELLOCPATH = "./">
<cfset PARENTPATH = "../">

<cfinclude template="#RELLOCPATH#noHeaderPages/validateUser.cfm">

and in validateUser.cfm
<!--- validate user login --->
<!--- check for existance of Auth structure created during valid login --->
<cfif not isDefined("SESSION.Auth.UserID") OR not isDefined("SESSION.Auth.AccessLevel")>
      <!--- invalid login --->
      <cflocation url="#PARENTPATH#_errorPages/loginError.cfm" addtoken="No">
</cfif>

<!--- validate user level --->
<!--- compare the access level defined on the page to the user's access level --->
<cfif SESSION.Auth.AccessLevel LT localAccessLevel>
      <!--- invalid user access level error --->      
      <cflocation url="#PARENTPATH#_errorPages/levelError.cfm" addtoken="No">
</cfif>
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 11794673
Or you can use a role based method and then if you are using a homegrown approach

<cfif Find("Admin", Session.UserAccess)>
  User allowed
<cfelse>
  User not an admin - cflocation them away
</cfif>
0
 

Expert Comment

by:Tony-28
ID: 13767595
Sorry I am new to ASP and would like to know how to create a session variable
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 13767665
Tony-28, please do not post new questions at the end of other questions.  If you have a question, then create your own in the appropriate Topic Area (in your case use the ASP topic area NOT the cold fusion topic area)
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Citrix Web Interface 5.4 logon section customization 2 74
LAMP problem identifier tool ? 9 110
IIS url rewrite rule for web application 3 52
wordpress email form 23 72
This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now