首先,必須讓綱目能夠隱藏動作。執行 packageutil 指令,將 HIDE_ACTIONS 綱目內容設為 1。HIDE_ACTIONS 綱目內容是在最新版的綱目上設定。這個指令的格式如下:
packageutil setproperty –dbset <dbset> <user> <password> <schema> HIDE_ACTIONS 1
# Start User Code
# Set $result to 1 if the user has permission to perform
# this action, otherwise set it to 0.
$result = 0;
if ($session->IsUserSuperUser()) {
# A super user can always do this action.
$result = 1;
}
else {
my $GLA = $session->GetNameValue("ratl_GetLegalAction");
my $myName = $entity->GetDisplayName();
if ($GLA eq $myName) {
# This hook was called for hide action.
# To hide the action, return 0 by uncommenting the following line
# $result = 0
# and then delete or comment out the $result = 1 below
#
# Or, to always show the action so the user will see
# a detailed message if they try to run it.
$result = 1;
}
else {
my $user = $session->GetUserLoginName();
my $owner = $entity->GetFieldStringValue("Owner");
if ($user ne $owner) {
die "Only the owner can perform this action.";
}
$result = 1;
}
}
# End User Code
轉至 IBM® Rational® Support YouTube 頻道,以進一步瞭解隱藏動作。