AFS-Command
view release on metacpan or search on metacpan
lib/AFS/Command/PTS.pod view on Meta::CPAN
#
# $Id: PTS.pod,v 7.1 2004/01/13 19:01:13 wpm Exp $
#
# (c) 2003-2004 Morgan Stanley and Co.
# See ..../src/LICENSE for terms of distribution.
#
=head1 NAME
AFS::Command::PTS - OO API to the AFS pts command
=head1 SYNOPSIS
use AFS::Command::PTS;
my $pts = AFS::Command::PTS->new();
my $pts = AFS::Command::PTS->new
(
command => $path_to_your_pts_binary,
);
my $pts = AFS::Command::PTS->new
(
noauth => 1,
force => 1,
);
=head1 DESCRIPTION
This module implements an OO API wrapper around the AFS 'pts' command.
The supported methods depend on the version of the pts binary used,
and are determined automagically.
=head1 METHODS -- Inherited
All of the following methods are inherited from the AFS::Command::Base
class. See that documentation for details.
=over
=item new
=item errors
=item supportsOperation
=item supportsArgument
=back
=head1 METHODS (with complex return values)
=head2 creategroup
=over
=item Arguments
The pts help string is:
pts creategroup: create a new group
Usage: pts creategroup -name <group name>+ [-owner <owner of the group>]
[-id <id (negated) for the group>+]
[-cell <cell name>] [-noauth] [-force]
The corresponding method invocation looks like:
my $result = $pts->creategroup
(
# Required arguments
name => $name, # OR [ $name1, $name2, ... ]
# Optional arguments
owner => $owner,
id => $id, # OR [ $id1, $id2, ... ]
cell => $cell,
noauth => 1,
force => 1,
);
=item Return Values
This method returns an AFS::Object::PTServer object, which
contains one AFS::Object::Group for each group created.
my $result = $pts->creategroup
(
name => $name,
owner => $owner,
) || die $pts->errors();
foreach my $group ( $result->getGroups() ) {
lib/AFS/Command/PTS.pod view on Meta::CPAN
# Optional arguments
cell => $cell,
noauth => 1,
force => 1,
);
=item Return Values
This method returns an AFS::Object::PTServer object, which
contains one AFS::Object::User or AFS::Object::Group
object for each user/group specified.
my $result = $pts->membership
(
nameorid => $user,
cell => $cell,
) || die $pts->errors();
my $userobj = $result->getUserbyName($user);
print "User $user is a member of these groups:\n";
foreach my $group ( $userobj->getMembership() ) {
print "\t$group\n";
}
Each of these objects has the following attributes and methods:
B<AFS::Object::PTServer>
Methods Returns
------- -------
getGroupNames() list of group names
getGroupIds() list of group ids
getGroups() list of AFS::Object::Group objects
getGroupByName($name) the AFS::Object::Group object for group $name
getGroupById($id) the AFS::Object::Group object for id $id
getGroup( name => $name ) the AFS::Object::Group object for group $name
getGroup( id => $id ) the AFS::Object::Group object for id $id
getUserNames() list of user names
getUserIds() list of user ids
getUsers() list of AFS::Object::User objects
getUserByName($name) the AFS::Object::User object for user $name
getUserById($id) the AFS::Object::User object for id $id
getUser( name => $name ) the AFS::Object::User object for user $name
getUser( id => $id ) the AFS::Object::User object for id $id
B<AFS::Object::User>, B<AFS::Object::Group>
Attributes Values
---------- ------
name User or group name
id User or group id
Methods Returns
------- -------
getMembership() For a user, the list of group to which the user belongs,
for a group, the members of the group
=back
=head1 METHODS (with simple return values)
All of the following commands return a simple Boolean (true/false)
value, if they succeed or fail.
=head2 adduser
The pts help string is:
pts adduser: add a user to a group
Usage: pts adduser -user <user name>+ -group <group name>+
[-cell <cell name>] [-noauth] [-force]
The corresponding method invocation looks like:
my $result = $pts->adduser
(
# Required arguments
user => $user, # OR [ $user1, $user2, ... ]
group => $group, # OR [ $group1, $group2, ... ]
# Optional arguments
cell => $cell,
noauth => 1,
force => 1,
);
=head2 chown
The pts help string is:
pts chown: change ownership of a group
Usage: pts chown -name <group name> -owner <new owner>
[-cell <cell name>] [-noauth] [-force]
The corresponding method invocation looks like:
my $result = $pts->chown
(
# Required arguments
name => $name,
owner => $owner,
# Optional arguments
cell => $cell,
noauth => 1,
force => 1,
);
=head2 delete
The pts help string is:
pts delete: delete a user or group from database
Usage: pts delete -nameorid <user or group name or id>+
[-cell <cell name>] [-noauth] [-force]
The corresponding method invocation looks like:
my $result = $pts->delete
(
# Required arguments
nameorid => $nameorid, # OR [ $nameorid1, $nameorid2, ... ]
# Optional arguments
cell => $cell,
( run in 0.482 second using v1.01-cache-2.11-cpan-d8267643d1d )