use of com.google.gerrit.extensions.common.AccountDetailInfo in project gerrit by GerritCodeReview.
the class GetAccountDetailIT method getDetailForServiceUser.
@Test
public void getDetailForServiceUser() throws Exception {
Account.Id serviceUser = accountOperations.newAccount().create();
groupOperations.group(groupCache.get(AccountGroup.nameKey(ServiceUserClassifier.SERVICE_USERS)).get().getGroupUUID()).forUpdate().addMember(serviceUser).update();
RestResponse r = adminRestSession.get("/accounts/" + serviceUser.get() + "/detail/");
AccountDetailInfo info = newGson().fromJson(r.getReader(), AccountDetailInfo.class);
assertThat(info.tags).containsExactly(AccountInfo.Tags.SERVICE_USER);
}
use of com.google.gerrit.extensions.common.AccountDetailInfo in project gerrit by GerritCodeReview.
the class GetDetail method apply.
@Override
public Response<AccountDetailInfo> apply(AccountResource rsrc) throws PermissionBackendException {
Account a = rsrc.getUser().getAccount();
AccountDetailInfo info = new AccountDetailInfo(a.id().get());
info.setRegisteredOn(a.registeredOn());
info.inactive = !a.isActive() ? true : null;
directory.fillAccountInfo(Collections.singleton(info), EnumSet.allOf(FillOptions.class));
return Response.ok(info);
}
use of com.google.gerrit.extensions.common.AccountDetailInfo in project gerrit by GerritCodeReview.
the class AccountIT method getOwnDetail.
@Test
public void getOwnDetail() throws Exception {
String email = "preferred@example.com";
String name = "Foo";
String username = name("foo");
TestAccount foo = accountCreator.create(username, email, name, null);
String secondaryEmail = "secondary@example.com";
EmailInput input = newEmailInput(secondaryEmail);
gApi.accounts().id(foo.id().get()).addEmail(input);
String status = "OOO";
gApi.accounts().id(foo.id().get()).setStatus(status);
requestScopeOperations.setApiUser(foo.id());
AccountDetailInfo detail = gApi.accounts().id(foo.id().get()).detail();
assertThat(detail._accountId).isEqualTo(foo.id().get());
assertThat(detail.name).isEqualTo(name);
assertThat(detail.username).isEqualTo(username);
assertThat(detail.email).isEqualTo(email);
assertThat(detail.secondaryEmails).containsExactly(secondaryEmail);
assertThat(detail.status).isEqualTo(status);
assertThat(detail.registeredOn.getTime()).isEqualTo(getAccount(foo.id()).registeredOn().toEpochMilli());
assertThat(detail.inactive).isNull();
assertThat(detail._moreAccounts).isNull();
}
use of com.google.gerrit.extensions.common.AccountDetailInfo in project gerrit by GerritCodeReview.
the class AccountIT method detailOfOtherAccountIncludeSecondaryEmailsWithModifyAccount.
@Test
public void detailOfOtherAccountIncludeSecondaryEmailsWithModifyAccount() throws Exception {
String email = "preferred@example.com";
TestAccount foo = accountCreator.create(name("foo"), email, "Foo", null);
String secondaryEmail = "secondary@example.com";
EmailInput input = newEmailInput(secondaryEmail);
gApi.accounts().id(foo.id().get()).addEmail(input);
AccountDetailInfo detail = gApi.accounts().id(foo.id().get()).detail();
assertThat(detail.secondaryEmails).containsExactly(secondaryEmail);
}
use of com.google.gerrit.extensions.common.AccountDetailInfo in project gerrit by GerritCodeReview.
the class AccountIT method detailOfOtherAccountDoesntIncludeSecondaryEmailsWithoutModifyAccount.
@Test
public void detailOfOtherAccountDoesntIncludeSecondaryEmailsWithoutModifyAccount() throws Exception {
String email = "preferred@example.com";
TestAccount foo = accountCreator.create(name("foo"), email, "Foo", null);
String secondaryEmail = "secondary@example.com";
EmailInput input = newEmailInput(secondaryEmail);
gApi.accounts().id(foo.id().get()).addEmail(input);
requestScopeOperations.setApiUser(user.id());
AccountDetailInfo detail = gApi.accounts().id(foo.id().get()).detail();
assertThat(detail.secondaryEmails).isNull();
}
Aggregations