GetUserGroups

Description

Returns a list of active user groups to which the current user belongs.

The returned list can be empty.

Syntaxe

VBScript

session.GetUserGroups

Perl

$session->GetUserGroups();
Identificateur
Description
session
Objet Session représentant la session en cours d'accès à la base de données.
Valeur de retour
For Visual Basic, a Variant containing an array String of Variants is returned. Each String names an active group to which the current user belongs (that is, the user under whose login name the database is currently being accessed).

For Perl, a reference to an array of strings is returned.

Exemples

VBScript

set sessionObj = GetSession

' Iterate over the user's groups
userGroups = sessionObj.GetUserGroups
If IsEmpty(userGroups) Then

   ' Code to handle if no user groups exist

Else

   For Each group in userGroups
      ' ...
Next

Perl

use strict;

use CQPerlExt;



# Create session object

my $sessionObj = CQSession::Build();

$sessionObj->UserLogon("user", "password", "SAMPL", "");



# get the user groups

my $userGroups = $sessionObj->GetUserGroups();



if (!@$userGroups) {

    #Code to handle if no user groups exist

    print "no user groups\n";

}

else {

    # print out all groups

    foreach my $group (@$userGroups) {

        print "Group $group\n";

    }

}

exit(0);

CQSession::Unbuild($sessionObj);

Commentaires