line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## @file |
2
|
|
|
|
|
|
|
# UserDB Google module |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
## @class |
5
|
|
|
|
|
|
|
# UserDB Google module |
6
|
|
|
|
|
|
|
package Lemonldap::NG::Portal::UserDBGoogle; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
502
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
9
|
1
|
|
|
1
|
|
614
|
use Lemonldap::NG::Portal::Simple; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Lemonldap::NG::Common::Regexp; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '1.4.0'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
## @apmethod int userDBInit() |
15
|
|
|
|
|
|
|
# Check if authentication module is Google |
16
|
|
|
|
|
|
|
# @return Lemonldap::NG::Portal error code |
17
|
|
|
|
|
|
|
sub userDBInit { |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
unless ( $self->get_module('auth') =~ /^Google/ ) { |
21
|
|
|
|
|
|
|
$self->lmLog( |
22
|
|
|
|
|
|
|
'UserDBGoogle isn\'t useable unless authentication module is set to Google', |
23
|
|
|
|
|
|
|
'error' |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
return PE_ERROR; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
PE_OK; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
## @apmethod int getUser() |
31
|
|
|
|
|
|
|
# Does nothing |
32
|
|
|
|
|
|
|
# @return Lemonldap::NG::Portal error code |
33
|
|
|
|
|
|
|
sub getUser { |
34
|
|
|
|
|
|
|
PE_OK; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
## @apmethod int setSessionInfo() |
38
|
|
|
|
|
|
|
# Since the job is done by AuthGoogle, here just check that required |
39
|
|
|
|
|
|
|
# attributes are not null |
40
|
|
|
|
|
|
|
# @return Lemonldap::NG::Portal error code |
41
|
|
|
|
|
|
|
sub setSessionInfo { |
42
|
|
|
|
|
|
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my %vars = ( %{ $self->{exportedVars} }, %{ $self->{googleExportedVars} } ); |
45
|
|
|
|
|
|
|
while ( my ( $k, $v ) = each %vars ) { |
46
|
|
|
|
|
|
|
my $attr = $k; |
47
|
|
|
|
|
|
|
next |
48
|
|
|
|
|
|
|
unless ( $attr =~ s/^!// |
49
|
|
|
|
|
|
|
and $v =~ Lemonldap::NG::Common::Regexp::GOOGLEAXATTR() ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
unless ( defined( $self->{sessionInfo}->{$attr} ) ) { |
52
|
|
|
|
|
|
|
$self->lmLog( |
53
|
|
|
|
|
|
|
"Required parameter $attr is not provided by Google server, aborted", |
54
|
|
|
|
|
|
|
'warn' |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$self->{mustRedirect} = 0; |
58
|
|
|
|
|
|
|
return PE_MISSINGREQATTR; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
PE_OK; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
## @apmethod int setGroups() |
66
|
|
|
|
|
|
|
# Does nothing |
67
|
|
|
|
|
|
|
# @return Lemonldap::NG::Portal error code |
68
|
|
|
|
|
|
|
sub setGroups { |
69
|
|
|
|
|
|
|
PE_OK; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|