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