Access-control hooks restrict access to particular actions based on a specific set of criteria. In Rational ClearQuest Designer, you can restrict actions to specific groups of users by choosing a hook type of User Group, or you can give everyone access to the action by choosing All Users. Vous pouvez également choisir l'option Scripts pour définir l'accès au moyen d'un crochet VBScript ou Perl.
The following example shows how to limit access to a user named "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
' Tester si l'utilisateur actuel est autorisé à fermer ce bogue
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
# Renvoyer TRUE si l'utilisateur est autorisé à effectuer cette action
if ($username eq "Pat") {
$result = 1;
} else {
$result = 0;
}
return $result;
}