조치 액세스 제어 후크 예제

액세스 제어 후크는 특정 기준 세트를 기반으로 특정 조치에 대한 액세스를 제한합니다. Rational® ClearQuest® Designer에서 사용자 그룹의 후크 유형을 선택하여 조치를 특정 사용자 그룹으로 제한하거나 모든 사용자를 선택하여 모든 사람이 조치에 액세스할 수 있도록 설정할 수 있습니다. 또한 스크립트 옵션을 선택하여 액세스를 결정할 VBScript 또는 Perl 후크를 작성할 수도 있습니다.

다음 예제는 이름이 "Pat"인 사용자의 액세스를 제한하는 방법을 나타냅니다.

VBScript

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

Perl

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;

} 

피드백