2017-01-30 22:00:54 +01:00
|
|
|
package Lemonldap::NG::Portal::UserDB::WebID;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Mouse;
|
|
|
|
use Lemonldap::NG::Portal::Main::Constants qw(
|
|
|
|
PE_ERROR
|
|
|
|
PE_MISSINGREQATTR
|
|
|
|
PE_OK
|
|
|
|
);
|
|
|
|
|
|
|
|
extends 'Lemonldap::NG::Common::Module';
|
|
|
|
|
|
|
|
our $VERSION = '2.0.0';
|
|
|
|
|
|
|
|
# INITIALIZATION
|
|
|
|
|
|
|
|
sub init {
|
|
|
|
1;
|
|
|
|
}
|
|
|
|
|
|
|
|
# RUNNING METHODS
|
|
|
|
|
|
|
|
sub getUser {
|
|
|
|
PE_OK;
|
|
|
|
}
|
|
|
|
|
2020-12-22 15:17:23 +01:00
|
|
|
sub findUser {
|
|
|
|
PE_OK;
|
|
|
|
}
|
|
|
|
|
2017-01-30 22:00:54 +01:00
|
|
|
sub setSessionInfo {
|
|
|
|
my ( $self, $req ) = @_;
|
2018-07-05 22:56:16 +02:00
|
|
|
unless ( $req->data->{_webid} ) {
|
2017-02-15 07:41:50 +01:00
|
|
|
$self->logger->error('No webid object found');
|
2017-01-30 22:00:54 +01:00
|
|
|
return PE_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
my %vars = (
|
|
|
|
%{ $self->conf->{exportedVars} },
|
|
|
|
%{ $self->conf->{webIDExportedVars} }
|
|
|
|
);
|
|
|
|
while ( my ( $k, $v ) = each %vars ) {
|
|
|
|
my $attr = $k;
|
|
|
|
my $req;
|
|
|
|
$attr =~ s/^!// and $req = 1;
|
2018-07-05 22:56:16 +02:00
|
|
|
eval { $req->{sessionInfo}->{$attr} = $req->data->{_webid}->get($v) };
|
2017-02-15 07:41:50 +01:00
|
|
|
$self->logger->error("Unable to get $v from FOAF document: $@")
|
2017-01-30 22:00:54 +01:00
|
|
|
if ($@);
|
|
|
|
if ( $req and not $req->{sessionInfo}->{$attr} ) {
|
2017-02-15 15:16:59 +01:00
|
|
|
$self->userLogger->warn(
|
2017-01-30 22:00:54 +01:00
|
|
|
"Required attribute $v is missing (user: $req->{user})");
|
|
|
|
return PE_MISSINGREQATTR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub setGroups {
|
|
|
|
PE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|