line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: GroupAdmin.pm,v 1.2 2003/01/16 19:41:31 lstein Exp $ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTTPD::GroupAdmin; |
4
|
2
|
|
|
2
|
|
12
|
use HTTPD::AdminBase (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
40
|
|
5
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
80
|
|
6
|
2
|
|
|
2
|
|
12
|
use vars qw($VERSION @ISA $DLM); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1270
|
|
7
|
|
|
|
|
|
|
@ISA = qw(HTTPD::AdminBase); |
8
|
|
|
|
|
|
|
$DLM = " "; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = 1.50; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub delete { |
14
|
0
|
|
|
0
|
1
|
0
|
my($self,$username,$group) = @_; |
15
|
0
|
0
|
|
|
|
0
|
$group = $self->{NAME} unless defined $group; |
16
|
0
|
0
|
|
|
|
0
|
return unless $self->{'_HASH'}->{$group}; |
17
|
0
|
|
|
|
|
0
|
$self->{'_HASH'}->{$group} =~ s/(^|$DLM)$username($DLM|$)/$1$2/; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub list { |
21
|
27
|
|
|
27
|
1
|
29
|
my($self, $group) = @_; |
22
|
27
|
100
|
|
|
|
45
|
return keys %{$self->{'_HASH'}} unless $group; |
|
7
|
|
|
|
|
28
|
|
23
|
20
|
50
|
|
|
|
38
|
return unless $self->{'_HASH'}{$group}; |
24
|
20
|
|
|
|
|
84
|
split /\s+/, $self->{'_HASH'}{$group}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub create { |
28
|
0
|
|
|
0
|
0
|
0
|
my($self,$group) = @_; |
29
|
0
|
0
|
|
|
|
0
|
return unless $group; |
30
|
0
|
0
|
|
|
|
0
|
return (0, "group '$group' exists") if $self->exists($group); |
31
|
0
|
|
|
|
|
0
|
$self->{'_HASH'}{$group} = ""; |
32
|
0
|
|
|
|
|
0
|
1; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub exists { |
36
|
0
|
|
|
0
|
1
|
0
|
my($self, $name, $user) = @_; |
37
|
0
|
0
|
|
|
|
0
|
return 0 unless defined $self->{'_HASH'}{$name}; |
38
|
0
|
0
|
|
|
|
0
|
return $self->{'_HASH'}{$name} unless $user; |
39
|
0
|
|
|
|
|
0
|
return grep { $_ eq $user } $self->list($name); |
|
0
|
|
|
|
|
0
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub db { |
43
|
4
|
|
|
4
|
1
|
8
|
my($self, $file) = @_; |
44
|
4
|
|
|
|
|
7
|
my $old = $self->{'DB'}; |
45
|
4
|
50
|
|
|
|
11
|
return $old unless $file; |
46
|
4
|
50
|
|
|
|
11
|
if($self->{'_HASH'}) { |
47
|
0
|
|
|
|
|
0
|
$self->DESTROY; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
4
|
|
|
|
|
8
|
$self->{'DB'} = $file; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
#return unless $self->{NAME}; |
53
|
4
|
50
|
|
|
|
24
|
$self->lock || Carp::croak(); |
54
|
4
|
|
|
|
|
25
|
$self->_tie('_HASH', $self->{DB}); |
55
|
4
|
|
|
|
|
11
|
$old; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub user { |
59
|
0
|
|
|
0
|
1
|
|
my($self) = shift; |
60
|
0
|
|
|
|
|
|
$self->load('HTTPD::UserAdmin'); |
61
|
0
|
|
|
|
|
|
my %attr = %{$self}; |
|
0
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
delete $attr{DB}; #just incase, everything else should be OK |
63
|
0
|
|
|
|
|
|
return new HTTPD::UserAdmin (%attr, @_); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
1
|
|
sub name { shift->_elem('NAME', @_) } |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
#These should work fine with the _generic classes |
69
|
|
|
|
|
|
|
my %Support = (apache => [qw(Text SQL)], |
70
|
|
|
|
|
|
|
ncsa => [qw(DBM Text)], |
71
|
|
|
|
|
|
|
netscape => [qw(DBM)] |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
HTTPD::GroupAdmin->support(%Support); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |