Permalink
Browse files

UP-3554: Allow non-local accounts to be edited in the User Manager

  • Loading branch information...
1 parent aa7c237 commit f7a83b5efc60c774827d61c4397e530839259cf3 @drewwills drewwills committed Aug 20, 2012
@@ -30,6 +30,10 @@
*/
public interface ILocalAccountPerson {
+ /**
+ * The local account Id of this person object. NOTE: This is not the same
+ * as the value of {@link IPerson#getID}.
+ */
public long getId();
public String getName();
@@ -160,6 +160,17 @@ public PersonForm getForm(String username) {
ILocalAccountPerson person = accountDao.getPerson(username);
+ if (person == null) {
+ /*
+ * NOTE: We're probably here because an admin is editing attributes
+ * on a user that is non-local in origin. We need to create an
+ * ILocalAccountPerson instance representing the user to support
+ * this use case, but we're using the getForm() version, not the
+ * getNewAccountForm(), because the username is already known.
+ */
+ person = accountDao.createPerson(username);
+ }
+
PersonForm form = new PersonForm(accountEditAttributes);
form.setUsername(person.getName());
form.setId(person.getId());
@@ -207,12 +218,7 @@ public boolean canImpersonateUser(IPerson currentUser, String target) {
}
public boolean canEditUser(IPerson currentUser, String target) {
-
- // first check to see if this is a local user
- if (!isLocalAccount(target)) {
- return false;
- }
-
+
EntityIdentifier ei = currentUser.getEntityIdentifier();
IAuthorizationPrincipal ap = AuthorizationService.instance().newPrincipal(ei.getKey(), ei.getType());

0 comments on commit f7a83b5

Please sign in to comment.