boolean expression evaluation algorithm

Discussion in 'ASP General' started by Simon Wigzell, Jul 24, 2004.

  1. 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!
     
    Simon Wigzell, Jul 24, 2004
    #1
    1. Advertising

  2. Simon Wigzell

    Bullschmidt Guest

    <<
    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!
     
    Bullschmidt, Jul 27, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. webposter
    Replies:
    2
    Views:
    714
    Peter Shaggy Haywood
    Sep 14, 2004
  2. Stef Mientki

    (no) fast boolean evaluation ?

    Stef Mientki, Aug 2, 2007, in forum: Python
    Replies:
    35
    Views:
    850
    Bruno Desthuilliers
    Aug 6, 2007
  3. J Leonard
    Replies:
    4
    Views:
    12,885
    Mark Space
    Jan 19, 2008
  4. jens wille

    evaluation in boolean context

    jens wille, Oct 10, 2006, in forum: Ruby
    Replies:
    6
    Views:
    113
    Robert Klemme
    Oct 11, 2006
  5. Metre Meter
    Replies:
    7
    Views:
    459
    Metre Meter
    Aug 6, 2010
Loading...

Share This Page