GetUserGroups
Description
Returns a list of active user groups to which the current user belongs.
The returned list can be empty.
Syntax
VBScript
session.GetUserGroups
Perl
$session->GetUserGroups
();
- Identifier
- Description
- session
- The Session object that represents the current database-access session.
- Return value
- 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.
Examples
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);