diff options
Diffstat (limited to 'lib/CatDap')
-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; } |