Implemented ssh command create-group
Often, when creating a new gerrit project a gerrit admin needs to create a new project owner group and setup an initial set of group members. This was only possible from gerrit's Web UI and was a realtively slow process compared to the easiness of creating the project using the create-project ssh command. This command makes it possible to create a new group, assign group members, owner group and description via ssh. Bug: issue 313 Change-Id: I9fbc013bd5e596f0b23e411ee0cc72d5f67b5f39 Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
This commit is contained in:
@@ -46,8 +46,8 @@ public class AccountResolver {
|
||||
*
|
||||
* @param nameOrEmail a string of the format
|
||||
* "Full Name <email@example>", just the email address
|
||||
* ("email@example"), a full name ("Full Name"), or an account id
|
||||
* ("18419").
|
||||
* ("email@example"), a full name ("Full Name"), an account id
|
||||
* ("18419") or an user name ("username").
|
||||
* @return the single account that matches; null if no account matches or
|
||||
* there are multiple candidates.
|
||||
*/
|
||||
@@ -61,7 +61,16 @@ public class AccountResolver {
|
||||
return byId.get(Account.Id.parse(nameOrEmail)).getAccount();
|
||||
}
|
||||
|
||||
return findByNameOrEmail(nameOrEmail);
|
||||
Account account = findByNameOrEmail(nameOrEmail);
|
||||
if (account != null) {
|
||||
return account;
|
||||
}
|
||||
|
||||
if (nameOrEmail.matches(Account.USER_NAME_PATTERN)) {
|
||||
return findByUserName(nameOrEmail);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,4 +114,9 @@ public class AccountResolver {
|
||||
final List<Account> r = rs.toList();
|
||||
return r.size() == 1 ? r.get(0) : null;
|
||||
}
|
||||
|
||||
private Account findByUserName(final String userName) throws OrmException {
|
||||
AccountState as = byId.getByUsername(userName);
|
||||
return as != null ? as.getAccount() : null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user