[system] / trunk / webwork2 / lib / WeBWorK / DB / Auth.pm Repository:
ViewVC logotype

Diff of /trunk/webwork2/lib/WeBWorK/DB/Auth.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 334 Revision 337
52 $self->{$db."_db"}->disconnect; 52 $self->{$db."_db"}->disconnect;
53} 53}
54 54
55# ----- 55# -----
56 56
57sub getUsers($) {
58 my $self = shift;
59 return unless $self->{password_db}->connect("ro");
60 my @password_users = keys %{$self->{password_db}->hashRef};
61 $self->{password_db}->disconnect;
62 return unless $self->{permissions_db}->connect("ro");
63 my @permissions_users = keys %{$self->{permissions_db}->hashRef};
64 $self->{permissions_db}->disconnect;
65 return unless $self->{keys_db}->connect("ro");
66 my @keys_users = keys %{$self->{keys_db}->hashRef};
67 $self->{keys_db}->disconnect;
68 my %all_users;
69 $all_users{$_}++ foreach (@password_users, @permissions_users, @keys_users);
70 return keys %all_users;
71}
72
73# -----
74
57sub getPassword($$) { 75sub getPassword($$) {
58 my $self = shift; 76 my $self = shift;
59 my $user = shift; 77 my $user = shift;
60 return unless $self->{password_db}->connect("rw"); 78 return unless $self->{password_db}->connect("ro");
61 my $result = $self->{password_db}->hashRef->{$user}; 79 my $result = $self->{password_db}->hashRef->{$user};
62 $self->{password_db}->disconnect; 80 $self->{password_db}->disconnect;
63 return $result; 81 return $result;
64} 82}
65 83
92# ----- 110# -----
93 111
94sub getKey($$) { 112sub getKey($$) {
95 my $self = shift; 113 my $self = shift;
96 my $user = shift; 114 my $user = shift;
97 return unless $self->{keys_db}->connect("rw"); 115 return unless $self->{keys_db}->connect("ro");
98 my $result = $self->{keys_db}->hashRef->{$user}; 116 my $result = $self->{keys_db}->hashRef->{$user};
99 $self->{keys_db}->disconnect; 117 $self->{keys_db}->disconnect;
100 my ($key, $timestamp) = defined $result ? split /\s+/, $result : (undef, undef); 118 my ($key, $timestamp) = defined $result ? split /\s+/, $result : (undef, undef);
101 return defined $result ? split /\s+/, $result : undef; 119 return defined $result ? split /\s+/, $result : undef;
102} 120}
138# ----- 156# -----
139 157
140sub getPermissions($$) { 158sub getPermissions($$) {
141 my $self = shift; 159 my $self = shift;
142 my $user = shift; 160 my $user = shift;
143 return unless $self->{permissions_db}->connect("rw"); 161 return unless $self->{permissions_db}->connect("ro");
144 my $result = $self->{permissions_db}->hashRef->{$user}; 162 my $result = $self->{permissions_db}->hashRef->{$user};
145 $self->{permissions_db}->disconnect; 163 $self->{permissions_db}->disconnect;
146 return $result; 164 return $result;
147} 165}
148 166

Legend:
Removed from v.334  
changed lines
  Added in v.337

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9