Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > boolean expression evaluation algorithm

Reply
Thread Tools

boolean expression evaluation algorithm

 
 
Simon Wigzell
Guest
Posts: n/a
 
      07-24-2004
A client wants have acess to an online databases records controlled by group
strings and evaluation strings e.g., each use would have in his client
record a group string like this:

[ROOT][ADMIN][ACCOUNTING][ABC PRODUCTS]

And each record in a database would have an evaluation string like this :

([ROOT] OR [ADMIN] OR [ACCOUNTING] OR [FINANCE]) AND [ABC PRODUCTS] OR
[ACME]) etc.

No limit to the number of groups or the complexity of the evaluation
expression. I need an asp function that I will just pass the group string
and the evaluation string and it will return True or False as to whether the
client can view that particular record. I can't find anything in ASP on the
internet though this must be a common database control method for
non-browser applications? Has anyone done anything like this in ASP? Thanks!


 
Reply With Quote
 
 
 
 
Bullschmidt
Guest
Posts: n/a
 
      07-27-2004
<<
A client wants have acess to an online databases records controlled by
group
strings and evaluation strings e.g., each use would have in his client
record a group string like this:

[ROOT][ADMIN][ACCOUNTING][ABC PRODUCTS]

And each record in a database would have an evaluation string like this
:

([ROOT] OR [ADMIN] OR [ACCOUNTING] OR [FINANCE]) AND [ABC PRODUCTS] OR
[ACME]) etc.

No limit to the number of groups or the complexity of the evaluation
expression. I need an asp function that I will just pass the group
string
and the evaluation string and it will return True or False as to whether
the
client can view that particular record. I can't find anything in ASP on
the
internet though this must be a common database control method for
non-browser applications? Has anyone done anything like this in ASP?
Thanks!
>>


Here's something like what I've often used to make sure someone is
allowed to view a page:

' If not valid user level.
If Not jpsvbIsInList("User;Admin", Session("UserLevel"), ";", True) Then
Response.Redirect mstrSiteMainSecure & "/login.asp"
End If

And later in the page's SQL statement I might actually used the CustID
of the user too.

And here is the custom jpsvbIsInList() function:

Function jpsvbIsInList(pvarList, pvarItem, pstrSeparator,
pbolIsCaseSensitive)
' Purpose: See if item is in list.
' Remarks: Typical separator can be ; or even multiple chars such as
comma space.

' Dim var.
Dim varItem
Dim varList
Dim intCompare

' Set var.
' (Uses VB constants.)
varItem = CStr(pvarItem)
varList = CStr(pstrSeparator & pvarList & pstrSeparator)
If pbolIsCaseSensitive Then
intCompare = vbBinaryCompare
Else
intCompare = vbTextCompare
End If

' Return val.
If InStr(1, varList, pstrSeparator & pvarItem & pstrSeparator,
intCompare) > 0 Then
jpsvbIsInList = True
Else
jpsvbIsInList = False
End If
End Function

Hope this helps,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Demo, ASP Bar Chart Tool...


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtle difference between boolean value and boolean comparison? Metre Meter Javascript 7 08-06-2010 08:40 PM
difference between 'boolean' and 'java.lang.Boolean' J Leonard Java 4 01-19-2008 02:56 AM
(no) fast boolean evaluation ? Stef Mientki Python 35 08-06-2007 07:44 AM
evaluation in boolean context jens wille Ruby 6 10-11-2006 03:17 AM
Short-Circuit Evaluation of Boolean Expressions webposter C Programming 2 09-14-2004 03:43 AM



Advertisments