NAME
Tivoli::AccessManager::Admin::Action
SYNOPSIS
use Tivoli::AccessManager::Admin;
my $pd = Tivoli::AccessManager::Admin->new( password => 'N3ew0nk' );
my ( @acts, $resp, @lists, @grps, @gnames );
# Create an action via new and create
$acts[0] = Tivoli::AccessManager::Admin::Action->new( $pd,
actionid => 'Z',
description => 'Action Z!',
type => 'This is action Z'
);
$resp = $acts[0]->create;
# Or, create an action through create alone
$resp = Tivoli::AccessManager::Admin::Action->create( $pd,
actionid => 'X',
description => 'Action X!',
type => 'This is action X'
);
$acts[1] = $resp->value if $resp->isok;
# Print the description, the type and the action id out
for my $act ( @acts ) {
print "Action ID : " . $act->id . "\n";
print "Description: " . $act->description . "\n";
print "Type : " . $act->type . "\n\n";
}
@gnames = qw/ateam dirty12 ratpack/;
# Create some action groups.
for my $name ( @gnames ) {
$resp = Tivoli::AccessManager::Admin::Action->group( $pd, create => $name );
push( @grps, $name ) if $resp->isok;
}
# Delete the groups
for my $name ( @gnames ) {
$resp = Tivoli::AccessManager::Admin::Action->group( $pd, delete => $name );
push( @grps, $name ) if $resp->isok;
}
# Create them another way, just for fun
$resp = Tivoli::AccessManager::Admin::Action->group( $pd, create => \@gnames );
@grps = @gnames if $resp->isok;
# Create a new actions in a group
$resp = Tivoli::AccessManager::Admin::Action->create( $pd,
actionid => 'T',
description => 'Pity the fool',
type => 'Mr T action',
group => 'ateam',
);
# Get the list of all the groups
$resp = Tivoli::AccessManager::Admin::Action->group;
# list the default actions
$resp = Tivoli::AccessManager::Admin::Action->list;
for my $obj ( @{$resp->value} ) {
printf "Found action %s -- %s\n",
$obj->id, $obj->description;
}
# list the actions in a group
$resp = Tivoli::AccessManager::Admin::Action->list( group => 'ateam' );
DESCRIPTION
Tivoli::AccessManager::Admin::Action implements the interface to the action portion of the API. I will warn you -- the underlying API is somewhat half baked.
CONSTRUCTORS
new( PDADMIN[, actionid => ID, description => DESC, type => TYPE, group => GROUP] )
Creates a blessed Tivoli::AccessManager::Admin::Action object. You will need to destroy this object if you wish to change the context.
Parameters
- PDADMIN
-
An initialized Tivoli::AccessManager::Admin::Context object. This is the only required parameter.
- actionid => ID
-
The action id to create. This is currently limitted by the C API to one character.
- description => DESC
-
A description of the action.
- type => TYPE
-
The action's type. This is usually a one word description thst is displayed by the WPM.
- group => GROUP
-
If provided, name the action group in which the action will be created.
Returns
A blessed Tivoli::AccessManager::Admin::Action object.
create( PDADMIN, actionid => ID, description => DESC, type => TYPE[, group => GROUP] )
Instantiates a Tivoli::AccessManager::Admin::Context object and creates the action in the policy database if used as a class method.
Parameters
The parameters are identical to those for "new". Unlike "new", they are all required, except for the group name.
Returns
A blessed Tivoli::AccessManager::Admin::Action object, buried in a Tivoli::AccessManager::Admin::Response object.
list(PDADMIN[, group => GROUP] )
Lists all the defined actions. The return is a list of Tivoli::AccessManager::Admin::Action objects, buried in a Tivoli::AccessManager::Admin::Response object.
Parameters
- PDADMIN
-
An initialized Tivoli::AccessManager::Admin::Context object. This is the only required arameter.
- group => GROUP
-
If provided, the return will be the list of actions within the named group. It will otherwise search the default group.
Returns
A list of blessed Tivoli::AccessManager::Admin::Action objects.
CLASS METHODS
group(PDADMIN[, create => name, remove => name ] )
Lists, creates and/or deletes action groups. If none of the optional parameters are provided, "group" will return a list of all the action groups.
Parameters
- PDADMIN
-
An initialized Tivoli::AccessManager::Admin::Context object. This is the only required parameter.
- create => name
-
The name of an action group to create. This can also be a reference to an array of group names.
- remove => name
-
The name of an action group to remove. This can also be a reference to an array of group names. If create and remove are both specified, removes are done first.
Returns
Regardless of the operation performed, a list of action group names will be returned.
METHODS
create( [actionid => ID, description => DESC, type => TYPE, group => GROUP] )
Yes, this can called as an instance method if you want. Notice the different signature -- the context object is no longer required.
Parameters
See "new". Any parameter yiu did not provide to "new" must be provided to "create".
Returns
The results if the create operation
delete([group => GROUP])
Deletes the action.
Parameters
Returns
The results of the delete call.
id
Returns the action id. This is a read-only method.
Parameters
None
Returns
The action id.
description
Returns the description. This is a read-only method.
Parameters
None
Returns
The description.
type
Returns the type. This is a read-only method.
Parameters
None
Returns
The type.
ACKNOWLEDGEMENTS
See Tivoli::AccessManager::Admin for the list. This was not possible without the help of a bunch of people smarter than me.
BUGS
The underlying C API is very different from the other portions -- there is no way to get an ivadmin_action struct w/o doing a list. I have worked around this in the perl code. This is surely a bug.
There is no way to change the description or type w/o deleting the action and recreating it.
AUTHOR
Mik Firestone <mikfire@gmail.com>
COPYRIGHT
Copyright (c) 2004-2011 Mik Firestone. All rights reserved. This program is free software; you can redistibute it and/or modify it under the same terms as Perl itself.
All references to TAM, Tivoli Access Manager, etc are copyrighted, trademarked and otherwise patented by IBM.