GetHookSeesAllUsers

Description

Returns a Boolean that indicates whether the current hook sees all users or only the users that the current user is allowed to see. True means the current hook sees all users when it executes a query. False means the current hook can only see users the current user is allowed to see when it executes a query.

Remarque : Cette méthode est disponible dans la version 7.1.

Syntaxe

VBScript

session.GetHookSeesAllUsers 

Perl

session->GetHookSeesAllUsers(); 
Identificateur
Description
session
Objet Session représentant la session en cours d'accès à la base de données.
Valeur de retour
Returns a Boolean True if the current hook sees all users when it executes a user query. Returns False if the current hook can only see users the current user is allowed to see when it executes a user query.

Exemples

VBScript

sub project_ChoiceList(fieldname, choices)
  ' fieldname As String
  ' choices As Object
  ' le nom tu type d'enregistrement est Defect
  ' field name is project

set session = GetSession
dim curHooksSeesAllUsers

' Store current session "Context"
curHookSeesAllUsers = session.GetHookSeesAllUsers()

' set session context to "User Context"
session.SetHookSeesAllUsers(0)

set querydef = session.BuildQuery("project") 
querydef.BuildField("name") 
set resultset = session.BuildResultSet(querydef)
resultset.Execute 

status =resultset.MoveNext
Do While status = AD_SUCCESS 
   choices.AddItem resultSetObj.GetColumnValue(1) 
Loop 

End Sub

Perl

sub project_ChoiceList 
{
    my($fieldname) = @_;
    my @choices;
    # $fieldname as string scalar
    # @choices as string array
    # le nom du type d'enregistrement est Défaut
    # field name is Project

    # start building a query of the users 
    my $session = $entity->GetSession();
    my ($curHooksSeesAllUsers);

# store current "Context"
    $curHooksSeesAllUsers=$session->GetHookSeesAllUsers();

# set to "User Context"
    $session->SetHookSeesAllUsers(0);

    my ($queryDefObj, $resultSetObj);

    $queryDefObj = $session->BuildQuery("Project");

    # have the query return the desired
    # field of the user object(s)
    $queryDefObj->BuildField("Name");
    $resultSetObj = $session->BuildResultSet($queryDefObj);

    # run it
    $resultSetObj->Execute();

    # add each value in the returned column to the choicelist
    while
     ($resultSetObj->MoveNext() == $CQPerlExt::CQ_SUCCESS) {
         push(@choices,$resultSetObj->GetColumnValue(1));
    }

    return @choices;
}

Feedback