If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Is this possible? if so how do i do it, and what would the syntax be?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-07-09, 11:55
mind_grapes mind_grapes is offline
Registered User
 
Join Date: Jun 2009
Location: Midlands
Posts: 133
Is this possible? if so how do i do it, and what would the syntax be?

Hi all, hope you can help with the following.

I'm not the best when it comes to coding, im still learning. So please forgive the lack of terminology and poor example.

I am trying to write a statment that checks sevel conditions before sending the user to the page they need.

I was wondering if its possible to have something like the following, and if so what would the syntax be?

if firstname = jack
and department > 10
and securityLevel >= 10
and roleID >= 20
then
response.redirect("page.asp")
else
response.write("sorry you access Level is too low")

hope this makes sense, apologies if it doesn't.

Any information is most welcome.

Regards
MG
Reply With Quote
  #2 (permalink)  
Old 10-07-09, 18:24
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Absolutely.

Just remember that string literals need to be wrapped in double quotes
Code:
If firstname = "Jack" And ...
And that an If requires an End If!
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 10-08-09, 05:42
mind_grapes mind_grapes is offline
Registered User
 
Join Date: Jun 2009
Location: Midlands
Posts: 133
Hello, thanks for the reply.

I shall remember that.

Regards
MG
Reply With Quote
  #4 (permalink)  
Old 10-08-09, 10:20
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,071
I'd caution you against using numeric value ranges for security. You are creating a brittle security mechanism that ceases to work after an arbitrary number of "levels" or "roles" become necessary.

If you're ok with that risk, then so-be-it. Just make a conscious decision to accept the flaws.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #5 (permalink)  
Old 10-08-09, 12:13
mind_grapes mind_grapes is offline
Registered User
 
Join Date: Jun 2009
Location: Midlands
Posts: 133
HI teddy, thanks for the reply.

I'm still lacking much needed knowledge, so im a little undsure how id create a better version. Also, to be honest, I'm struggling to get this version working too. You Dont fancy lending me your brain do you? lol.

Regards
MG
Reply With Quote
  #6 (permalink)  
Old 10-08-09, 14:24
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,071
You might want to look at the ASP.NET membership provider model from an architecture perspective, which in turn shares many similarities with standard group-based security you might find in a common LDAP store.

The idea being that you assign permission roles to either a single user, or a group of users. So instead of assigning a security "level" number which provides accessed based on how high the number is, you would instead creating a set of security "roles" and assign them to whoever needs to fill that role. It ends up being more of an "true/false" thing instead of a "somewhere between 2 and 8" thing. That allows you to have an infinite number of roles, and an infinite number of users and/or groups who are able to assume that role.

Much more flexible, but it takes a bit more plumbing to make it work.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***

Last edited by Teddy; 10-08-09 at 14:31.
Reply With Quote
  #7 (permalink)  
Old 10-09-09, 04:46
mind_grapes mind_grapes is offline
Registered User
 
Join Date: Jun 2009
Location: Midlands
Posts: 133
I have a database with roles, department, user id and name, as well as security levels of 10 etc. Im just not clear how i would begin to write the code, or if it can be done be stored procedure?

Regards
MG
Reply With Quote
  #8 (permalink)  
Old 10-09-09, 07:37
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Perhaps you should post this as a design question here: Database Concepts & Design - dBforums
__________________
George
Twitter | Blog
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On