首先,必须启用该模式以隐藏操作。 运行 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 channel,以了解有关隐藏操作的更多信息。