diff options
author | Buchan Milne <buchan@mageia.org> | 2011-02-20 15:08:14 +0000 |
---|---|---|
committer | Buchan Milne <buchan@mageia.org> | 2011-02-20 15:08:14 +0000 |
commit | ec26c0cd9c55d4733cf24e0cc32d4211eec4428e (patch) | |
tree | be1f3f5756e255b440084e6cdc6d25009135e399 /lib/CatDap/Controller/admin.pm | |
parent | fbdcb10950854cc2ea54f390d528e98fd1e350ff (diff) | |
download | identity-ec26c0cd9c55d4733cf24e0cc32d4211eec4428e.tar identity-ec26c0cd9c55d4733cf24e0cc32d4211eec4428e.tar.gz identity-ec26c0cd9c55d4733cf24e0cc32d4211eec4428e.tar.bz2 identity-ec26c0cd9c55d4733cf24e0cc32d4211eec4428e.tar.xz identity-ec26c0cd9c55d4733cf24e0cc32d4211eec4428e.zip |
Fix admin submenu for group-only admins
Diffstat (limited to 'lib/CatDap/Controller/admin.pm')
-rw-r--r-- | lib/CatDap/Controller/admin.pm | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/CatDap/Controller/admin.pm b/lib/CatDap/Controller/admin.pm index 12076ae..bf837ae 100644 --- a/lib/CatDap/Controller/admin.pm +++ b/lib/CatDap/Controller/admin.pm @@ -605,10 +605,12 @@ sub group : Local { sub group_modify : Local { my ( $self, $c, $group, $op, $attr, $value ) = @_; $c->detach('/user/login') if not $c->user; + my $mainrole = 'account'; if ( ! $c->check_user_roles('Account Admins') and ! $c->check_user_roles('Group Admins')) { $c->res->forward('/user'); } - $c->stash( subpages => gensubpages('account') ); + $mainrole = 'group' if (not $c->check_user_roles('Account Admins')); + $c->stash( subpages => gensubpages($mainrole) ); my @errors; my @entries; my $mesg; @@ -617,13 +619,13 @@ sub group_modify : Local { push @errors, "Group contains illegal characters"; $c->detach('/admin/group'); } - if ($op eq 'delete') { + if (defined $op and $op eq 'delete') { $mesg = $c->model('user')->search("(&(objectClass=groupOfNames)(cn=$group))"); @entries = $mesg->entries; - @entries[0]->delete( $attr => $value)->update; + $entries[0]->delete( $attr => $value)->update; $c->res->redirect("/admin/group_modify/$group"); } - if ( $op eq 'add' ) { + if ( defined $op and $op eq 'add' ) { my $member = $c->req->param('member'); $mesg = $c->model('user')->search("(uid=$member)"); if ( $mesg->code ) { @@ -634,10 +636,10 @@ sub group_modify : Local { $c->detach('/admin/group'); } @entries = $mesg->entries; - my $dn = @entries[0]->dn; + my $dn = $entries[0]->dn; $mesg = $c->model('user')->search("(&(objectClass=groupOfNames)(cn=$group))"); @entries = $mesg->entries; - @entries[0]->add( 'member' => $dn )->update; + $entries[0]->add( 'member' => $dn )->update; $c->res->redirect("/admin/group_modify/$group"); } $mesg = $c->model('user')->search("(&(objectClass=groupOfNames)(cn=$group))"); @@ -685,7 +687,9 @@ sub gensubpages : Private { ); } if ( $type eq 'group' ) { + @subpagenames = ( { page => 'group', title => "Groups" }, + ); } return \@subpagenames; } |