/[soft]/identity/CatDap/trunk/lib/CatDap/Controller/admin.pm
ViewVC logotype

Diff of /identity/CatDap/trunk/lib/CatDap/Controller/admin.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1789 by misc, Thu Jul 21 12:11:34 2011 UTC revision 1790 by misc, Thu Jul 21 16:50:26 2011 UTC
# Line 619  sub group_modify : Local { Line 619  sub group_modify : Local {
619      my @errors;      my @errors;
620      my @entries;      my @entries;
621      my $mesg;      my $mesg;
622    
623      $c->detach('/admin/group') if $group eq '';      $c->detach('/admin/group') if $group eq '';
624      if ( $group !~ /^[\w\d- ]*$/ ) {      if ( $group !~ /^[\w\d- ]*$/ ) {
625          push @errors, $c->loc('Group contains illegal characters');          push @errors, $c->loc('Group contains illegal characters');
626          $c->detach('/admin/group');          $c->detach('/admin/group');
627      }      }
628    
629        my $mesg_group = $c->model('user')->search("(&(objectClass=groupOfNames)(cn=$group))");
630        if ( $mesg_group->entries gt 1 ) {
631            push @errors, $c->loc('More than one entry matched');
632            $c->detach('/admin/group');
633        }
634    
635      if (defined $op and $op eq 'delete') {      if (defined $op and $op eq 'delete') {
636          $mesg = $c->model('user')->search("(&(objectClass=groupOfNames)(cn=$group))");          @entries = $mesg_group->entries;
         @entries = $mesg->entries;  
637          $entries[0]->delete( $attr => $value)->update;          $entries[0]->delete( $attr => $value)->update;
638          $c->res->redirect("/admin/group_modify/$group");          $c->res->redirect("/admin/group_modify/$group");
639      }      }
640    
641      if ( defined $op and $op eq 'add' ) {      if ( defined $op and $op eq 'add' ) {
642          my $member = $c->req->param('member');          my $member = $c->req->param('member');
643          $mesg = $c->model('user')->search("(uid=$member)");          $mesg = $c->model('user')->search("(uid=$member)");
# Line 642  sub group_modify : Local { Line 650  sub group_modify : Local {
650          }          }
651          @entries = $mesg->entries;          @entries = $mesg->entries;
652          my $dn = $entries[0]->dn;          my $dn = $entries[0]->dn;
653          $mesg = $c->model('user')->search("(&(objectClass=groupOfNames)(cn=$group))");          @entries = $mesg_group->entries;
         @entries = $mesg->entries;  
654          $entries[0]->add( 'member' => $dn )->update;          $entries[0]->add( 'member' => $dn )->update;
655          $c->res->redirect("/admin/group_modify/$group");          $c->res->redirect("/admin/group_modify/$group");
656      }      }
657      $mesg = $c->model('user')->search("(&(objectClass=groupOfNames)(cn=$group))");  
658      if ( $mesg->entries gt 1 ) {      $c->stash( group => $mesg_group->entry );
         push @errors, $c->loc('More than one entry matched');  
         $c->detach('/admin/group');  
     }  
     $c->stash( group => $mesg->entry );  
659  }  }
660    
661  =head2 index  =head2 index

Legend:
Removed from v.1789  
changed lines
  Added in v.1790

  ViewVC Help
Powered by ViewVC 1.1.26