From cdb5874aab19a0bfe94ec449f3c298d65d370812 Mon Sep 17 00:00:00 2001 From: Mercier Pierre-Olivier Date: Thu, 12 Sep 2013 12:58:10 +0200 Subject: [PATCH] Various old fixes --- ACU/LDAP.pm | 18 +++++++++++++----- commands/project/grades.pl | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ACU/LDAP.pm b/ACU/LDAP.pm index 5b491e6..e5d37fc 100644 --- a/ACU/LDAP.pm +++ b/ACU/LDAP.pm @@ -338,10 +338,16 @@ sub get_rights($) scope => "sub" ); if ($mesg->code != 0) { die $mesg->error; } - if ($mesg->count != 1) { die "User $login not found or multiple presence"; } - for my $r ($mesg->entry(0)->get_value('intraRight')) { - push @rights, Right->new($r); + for my $entry ($mesg->entries) { + for my $r ($entry->get_value('intraRight')) { + if ($r =~ /^!(.*)$/) { + @rights = grep { ! /^\Q$r\E$/ } @rights; + } + else { + push @rights, Right->new($r); + } + } } @@ -354,8 +360,10 @@ sub get_rights($) if ($mesg->code != 0) { die $mesg->error; } if ($mesg->count != 1) { die "User $login not found or multiple presence"; } - for my $r ($mesg->entry(0)->get_value('intraRight')) { - push @rights, Right->new($r); + for my $entry ($mesg->entries) { + for my $r ($entry->get_value('intraRight')) { + push @rights, Right->new($r); + } } diff --git a/commands/project/grades.pl b/commands/project/grades.pl index cf1581f..f7e6d15 100644 --- a/commands/project/grades.pl +++ b/commands/project/grades.pl @@ -4,7 +4,7 @@ use v5.10.1; use strict; use warnings; -use lib "../"; +use lib "../../"; use ACU::API::Base; use ACU::API::Projects;