Allow to delegate modify account commands to non administrators

Currently only administrators groups allow to modify accounts. This
is impractical on very big installations. Add modify account global
capability and allow administrators to optionally delegate this job.

Bug: Issue 2786
Change-Id: Icc105c39e76908a075e89ec14921972b91866dd4
This commit is contained in:
David Ostrovsky
2014-07-22 00:55:47 +02:00
committed by David Pursehouse
parent e715d2484a
commit aa49e277a3
20 changed files with 48 additions and 27 deletions

View File

@@ -85,7 +85,7 @@ public class CreateEmail implements RestModifyView<AccountResource, Input> {
ResourceNotFoundException, OrmException, EmailException,
MethodNotAllowedException {
if (self.get() != rsrc.getUser()
&& !self.get().getCapabilities().canAdministrateServer()) {
&& !self.get().getCapabilities().canModifyAccount()) {
throw new AuthException("not allowed to add email address");
}
@@ -98,8 +98,8 @@ public class CreateEmail implements RestModifyView<AccountResource, Input> {
}
if (input.noConfirmation
&& !self.get().getCapabilities().canAdministrateServer()) {
throw new AuthException("must be administrator to use no_confirmation");
&& !self.get().getCapabilities().canModifyAccount()) {
throw new AuthException("not allowed to use no_confirmation");
}
return apply(rsrc.getUser(), input);