scripting@wanadoo.nl




InGroups()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
2 April 2002 InGroups()
AuthorScriptLogic Corporation
Action Checks whether the user is a member of a group, given a list of one or more groups.
SyntaxInGroups (GroupList, [All]) 
Parameters
  • GroupList (Required / Array) An array of group names. -or- A string containing a semicolon-separated list of groups.
  • All (Optional / Numeric) If a numeric 1 (or text string "all"), InGroups() will perform a Boolean AND on all groups passed to this function. If this parameter is omitted, a Boolean OR will be performed. 
  • Remarks*** Now built into KiXtart 4.10 ***. 
    ReturnsA numeric count of the total number of groups the user is a member of. If the user is not a member of any groups, a 0 is returned. If the optional "all" parameter is specified and the user is not a member of ALL the groups, a -1 is returned. 
    Examples
    $rc=InGroups('Accounting, Finance, Executive')
    ?'User is a member of '+$rc+' groups'
    $GroupArray='Accounting','Finance','Executive'
    $rc=InGroups($GroupArray)
    
    IF InGroups('Miami Users; Lauderdale Users; West Palm Users','All')
     ?'User is a member of all groups'
    ENDIF
    
     
    Source
    FUNCTION InGroups ($grouplist, OPTIONAL $anyall)
      ; Author: ScriptLogic Corporation
      ; Returns the total number of groups the user is
      ;  in, given one or more groups.
      ; $GroupList may be an array or a string
      ;  containing a semicolon-separated list of groups.
      ; if $AnyAll is 'All' (or 1), the user must be a
      ;  member of all groups specified, otherwise a -1
      ;  is returned
    
      $ingroups=0
      DIM $tmparray, $element
      IF VarType($grouplist) < 8192 ; not an array - create one from a CSV string
        $tmparray=Split($grouplist,';')
      ELSE
        $tmparray=$grouplist
      ENDIF
      FOR EACH $element IN $tmparray
        IF InGroup(Trim($element))
          $ingroups=$ingroups+1
        ENDIF
      NEXT
      IF (0+$anyall = 1 OR $anyall = 'All') AND $ingroups <> UBound($tmparray)+1
        $ingroups=-1
      ENDIF
    ENDFUNCTION ; - InGroups -
     
      original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
              printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




    Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


    Site Meter