Action access control hook example

Access-control hooks restrict access to particular actions based on a specific set of criteria. In DevOps Plan 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. You can also choose the Scripts option and write a Perl hook to determine access.

The following example shows how to limit access to a user named "Pat."

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;

}