Gli hook di controllo accesso limitano l'accesso a particolari azioni in base a una serie di criteri specifici. In Rational ClearQuest Designer, è possibile limitare le azioni a gruppi specifici di utenti selezionando un tipo di hook Gruppo utente oppure è possibile consentire l'accesso all'azione a tutti gli utenti scegliendo Tutti gli utenti. Inoltre è possibile selezionare l'opzione Script e scrivere un hook VBScript o Perl per determinare l'accesso.
Il seguente esempio mostra come limitare l'accesso a un utente denominato "Pat."
Function swbug_AccessControl(actionname, actiontype, username)
' actionname As String
' actiontype As Long
' username As String
' swbug_AccessControl As Boolean
' action = close
Dim is_ok
' Test whether the current user has the privilege to close this bug
If username = "Pat" Then
is_ok = TRUE
Else
is_ok = FALSE
End If
swbug_AccessControl = is_ok
End Function
sub swbug_AccessControl {
my($actioname, $actiontype, $username) = @_;
my $result;
# $actionname string scalar, $actiontype as long scalar
# $username as string scalar, # action is Close
# return TRUE if the user has permission to perform this action
if ($username eq "Pat") {
$result = 1;
} else {
$result = 0;
}
return $result;
}