• Synchronet Javascript..

    From Ktulu@VERT/ROI to All on Tue Apr 15 08:46:00 2008
    How do I go about checking if a user has a certain security level and / or a certain age? I mean what's the syntax of it?
    Thanks!!!

    --
    Ktulu
    ---
    þ Synchronet þ Realm of Insanity telnet://roi.synchro.net
  • From Tracker1@VERT/TRN to Ktulu on Tue Apr 15 18:13:30 2008
    On 04/14/2008 06:46 PM, Ktulu wrote:
    How do I go about checking if a user has a certain security level and
    / or a certain age? I mean what's the syntax of it? Thanks!!!

    There's actually a couple ways... the current user, is usually "user" as an instance... otherwise...

    for the JS object model used in sync, see http://www.synchro.net/docs/jsobjs.html
    also... http://www.synchro.net/docs/js.html

    var u = new User(#); //where # is the user number... forward, expecting "user"

    if (user.age >= 18) {
    //do something...
    }

    if (user.security.level > 60) {
    //do something
    }

    alternatively

    if (user.compare_ars("AGE 18 OR LEVEL 60")) {
    //do something
    }

    If you need some books on Javascript in general, let me know...

    NOTE: when you are doing multiple security checks, compare_ars uses the same format as other ARS strings in SCFG, and is generally an easier syntax, than longer JS evaluations, though probably a little longer to parse/execute, but it shouldn't be a huge deal... look at the .js files in the exec/ directory for tons of examples... you can find more information on ARS strings here http://www.synchro.net/docs/security.html

    --
    Michael J. Ryan - tracker1(at)theroughnecks(dot)net - www.theroughnecks.net icq: 4935386 - AIM/AOL: azTracker1 - Y!: azTracker1 - MSN/Win: (email)

    ... FRA #255: A wife is a luxury ... a smart accountant is a necessity.

    ---
    þ Synchronet þ theroughnecks.net - you know you want it