line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# system::ubuntu::user Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::System::Ubuntu::User; |
7
|
1
|
|
|
1
|
|
854
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use base qw(Metabrik::Shell::Command Metabrik::System::Package); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
385
|
|
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
|
|
|
|
|
|
|
ubuntu => [ qw(adduser) ], |
28
|
|
|
|
|
|
|
debian => [ qw(adduser) ], |
29
|
|
|
|
|
|
|
kali => [ qw(adduser) ], |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub create_user { |
35
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
36
|
0
|
|
|
|
|
|
my ($user) = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('create_user', $user) or return; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $cmd = "adduser $user"; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return $self->sudo_execute($cmd); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub add_user_to_group { |
46
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
47
|
0
|
|
|
|
|
|
my ($user, $group) = @_; |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('add_user_to_group', $user) or return; |
50
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('add_user_to_group', $group) or return; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $cmd = "adduser $user $group"; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return $self->sudo_execute($cmd); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |