From f31883ea438fc6ecabe3a1da24aecdced5e356e1 Mon Sep 17 00:00:00 2001 From: Buchan Milne Date: Wed, 16 Feb 2011 15:05:33 +0000 Subject: Fix displaying of groups with spaces in the name Fix non-ascii user details in 'promote' page --- lib/CatDap/Controller/admin.pm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'lib/CatDap/Controller') diff --git a/lib/CatDap/Controller/admin.pm b/lib/CatDap/Controller/admin.pm index da609bb..7fd5539 100644 --- a/lib/CatDap/Controller/admin.pm +++ b/lib/CatDap/Controller/admin.pm @@ -212,7 +212,16 @@ sub account_promote : Local { my $mesg = $c->model('user') ->search("(&(objectClass=inetOrgPerson)(!(objectClass=posixAccount)))"); - my @entries = $mesg->entries; + my @orig_entries = $mesg->entries; + my @entries; + foreach my $entry (@orig_entries) { + my %new_entry; + foreach my $attr($entry->attributes) { + $new_entry{$attr} = Encode::decode_utf8($entry->get_value($attr)); + } + push @entries, \%new_entry; + } + $c->stash( entries => \@entries ); push @errors, $mesg->error if $mesg->code; $mesg = $c->model('user')->search("(objectClass=posixGroup)"); @@ -563,7 +572,7 @@ sub group : Local { my $attribute = $c->req->param('attribute'); $attribute =~ s/[^\w\d]//g; my $value = $c->req->param('value'); - $value =~ s/[^\w\d\*]//g; + $value =~ s/[^\w\d\* ]//g; my $mesg = $c->model('user') ->search("(&(objectclass=posixGroup)($attribute=$value))"); @@ -583,9 +592,9 @@ sub group_modify : Local { $c->stash( subpages => gensubpages('account') ); my @errors; $c->detach('/admin/group') if $group eq ''; - if ( $group !~ /^[\w\d]*$/ ) { + if ( $group !~ /^[\w\d ]*$/ ) { push @errors, "Group contains illegal characters"; - $c->detach('admin/group'); + $c->detach('/admin/group'); } my $mesg = $c->model('user')->search("(&(objectClass=posixGroup)(cn=$group))"); -- cgit v1.2.1