aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catdap.yml1
-rw-r--r--lib/CatDap/Controller/user.pm18
-rw-r--r--root/user/add.tt4
-rw-r--r--root/user/delete.tt4
4 files changed, 20 insertions, 7 deletions
diff --git a/catdap.yml b/catdap.yml
index 14411f8..253d655 100644
--- a/catdap.yml
+++ b/catdap.yml
@@ -87,6 +87,7 @@ Controller::User:
- secretary
- mailForwardingAddress
- sshPublicKey
+ - preferredLanguage
# Currently not used, we only respect editable_attrs
uneditable_attrs:
diff --git a/lib/CatDap/Controller/user.pm b/lib/CatDap/Controller/user.pm
index 2d0ba04..f2171eb 100644
--- a/lib/CatDap/Controller/user.pm
+++ b/lib/CatDap/Controller/user.pm
@@ -223,6 +223,7 @@ sub index :Path :Args(0) {
grep /$attrname/,@attributes or
grep /$attrname/,@{${$c->config}{'Controller::User'}{'uneditable_attrs'}} or
grep /$attrname/,@{${$c->config}{'Controller::User'}{'skip_attrs'}} or
+ grep /$attrname/,@{${$c->config}{'Controller::User'}{'editable_attrs'}} and
push @may, $attrname;
}
}
@@ -247,7 +248,7 @@ sub add : Local {
my $entry = $mesg->entry;
$entry->add( $attr => $value);
$c->log->info("Adding $attr = $value to user $user");
- $entry->update;
+ $mesg = $entry->update;
push @{${$c->stash}{'errors'}},$mesg->error if $mesg->code;
$c->log->info($mesg->error);
$c->res->redirect('/user');
@@ -258,16 +259,19 @@ sub delete : Local : Args(2) {
my ($mesg,$entry,$user,$userfilter);
$user = $c->user->username;
$userfilter = $c->user->store->user_filter;
- $userfilter =~ s/%s/$c->user->username/g;
- $c->log->debug("Searching for user $user");
+ $userfilter =~ s/%s/$user/g;
+ $c->log->debug("Searching for user $user with filter $userfilter");
$mesg = $c->model('User')->search($userfilter);
+ push @{${$c->stash}{'errors'}},$mesg->error if $mesg->code;
+ $c->log->info($mesg->error) if $mesg->code;
$entry = $mesg->entry;
- $c->log->info("Deleting $attrname = $attrvalue from user $user");
+ $c->log->info("Deleting $attrname: $attrvalue from dn " . $entry->dn);
$entry->delete($attrname => $attrvalue);
- $entry->update;
+ $mesg = $entry->update;
push @{${$c->stash}{'errors'}},$mesg->error if $mesg->code;
- $c->log->info($mesg->error);
- $c->res->redirect('/user');
+ $c->log->info("Result of update: " . $mesg->error . "," . $mesg->code) if $mesg->code;
+ $c->res->redirect('/user') unless $mesg->code;
+ $c->stash({ attrname => $attrname, attrvalue => $attrvalue});
}
sub password : Local {
diff --git a/root/user/add.tt b/root/user/add.tt
new file mode 100644
index 0000000..eaf84aa
--- /dev/null
+++ b/root/user/add.tt
@@ -0,0 +1,4 @@
+An error occured adding the attribute [% attrname %]
+[% IF attrvalue %]with value [% attrvalue %][% END %].
+
+Please go back and try again
diff --git a/root/user/delete.tt b/root/user/delete.tt
new file mode 100644
index 0000000..a0adffd
--- /dev/null
+++ b/root/user/delete.tt
@@ -0,0 +1,4 @@
+An error occured deleting the attribute [% attrname %]
+[% IF attrvalue %]with value [% attrvalue %][% END %].
+
+Please go back and try again