line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# system::centos::user Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::System::Centos::User; |
7
|
1
|
|
|
1
|
|
819
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
4
|
use base qw(Metabrik::Shell::Command Metabrik::System::Package); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
374
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
15
|
|
|
|
|
|
|
tags => [ qw(unstable manage management creation group create) ], |
16
|
|
|
|
|
|
|
author => 'GomoR ', |
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
18
|
|
|
|
|
|
|
commands => { |
19
|
|
|
|
|
|
|
install => [ ], # Inherited |
20
|
|
|
|
|
|
|
create_user => [ qw(user) ], |
21
|
|
|
|
|
|
|
add_user_to_group => [ qw(user group) ], |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
require_binaries => { |
24
|
|
|
|
|
|
|
adduser => [ ], |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
need_packages => { |
27
|
|
|
|
|
|
|
centos => [ qw(shadow-utils) ], |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub create_user { |
33
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
34
|
0
|
|
|
|
|
|
my ($user) = @_; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('create_user', $user) or return; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $cmd = "adduser $user"; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return $self->sudo_execute($cmd); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub add_user_to_group { |
44
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
45
|
0
|
|
|
|
|
|
my ($user, $group) = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('add_user_to_group', $user) or return; |
48
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('add_user_to_group', $group) or return; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $cmd = "adduser $user $group"; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
return $self->sudo_execute($cmd); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |