アクション アクセス制御フック例

アクセス制御フックは、特定の条件セットに基づいて、特定のアクションへのアクセスを制限します。 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;

} 

フィードバック