Changeset 13 for LATMOS-Accounts
- Timestamp:
- 03/02/09 22:02:23 (15 years ago)
- Location:
- LATMOS-Accounts
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Unix.pm
r10 r13 54 54 } 55 55 56 sub _canonicals_fields { 57 my ($self, $type) = @_; 58 $type = lc($type); 59 { 60 user => { 61 uidNumber => 'uid', 62 gidNumber => 'gid', 63 gecos => 'gecos', 64 homeDirectory => 'home', 65 loginShell => 'shell', 66 userPassword => ($self->{use_shadow} ? 'spassword' : 'password'), 67 }, 68 group => { 69 gidNumber => 'gid', 70 memberUID => 'user_list', 71 }, 72 }->{$type} 73 } 74 75 sub list_canonicals_fields { 76 my ($self, $type) = @_; 77 keys %{ $self->_canonicals_fields($type) || {} } 78 } 79 80 sub get_field_name { 81 my ($self, $type, $cfield) = @_; 82 ($self->_canonicals_fields($type) || {})->{$cfield} 83 } 84 85 56 86 my @password_fields = qw(account password uid gid gecos home shell); 57 87 my @shadow_fields = qw(account spassword last_changed before_ch after_ch exp_warn exp_disable disable res); -
LATMOS-Accounts/t/11_bases_unix.t
r10 r13 1 1 use strict; 2 2 use warnings; 3 use Test::More tests => 8;3 use Test::More tests => 14; 4 4 use File::Temp; 5 5 … … 7 7 use_ok('LATMOS::Accounts::Bases::Objects'); 8 8 use_ok('LATMOS::Accounts::Bases::Unix'); 9 use_ok('LATMOS::Accounts::Bases::Unix::User'); 10 use_ok('LATMOS::Accounts::Bases::Unix::Group'); 9 11 10 12 my $dir = File::Temp::tempdir; … … 23 25 isa_ok($unixb, 'LATMOS::Accounts::Bases'); 24 26 isa_ok($unixb, 'LATMOS::Accounts::Bases::Unix'); 27 ok($unixb->load, "Can load unix base"); 25 28 26 ok($unixb->load, "Can load unix base"); 29 is( $unixb->get_field_name('user', 'homeDirectory'), "home", "can call get_fields_name"); 30 31 ok(my $user = $unixb->get_object('user', 'root'), "Can get root user"); 32 ok(my $group = $unixb->get_object('group', 'root'), "Can get root group"); 33 34 is($user->get_c_field('homeDirectory'), '/root', 'Can get home directory'); 35 27 36 ok($unixb->commit, "Can save unix base"); 28 37
Note: See TracChangeset
for help on using the changeset viewer.