Permit adding all users to reviews and groups
Prior to the REST API users could be added to a code review or to a group if a unique specification for their account is input. The visiblity flag managed by canSee() was only about presentation in suggestion results. Revert to that older behavior. A user should be able to add someone to a code review if they enter their email address exactly, even if suggestion does not trigger for the account. Group owners should be able to add anyone to a group for the same reason. Change-Id: Ie37fbcd944c20764267229eeaca319ceb3fc040c
This commit is contained in:
@@ -139,7 +139,7 @@ public class AccountControl {
|
|||||||
default:
|
default:
|
||||||
throw new IllegalStateException("Bad AccountVisibility " + accountVisibility);
|
throw new IllegalStateException("Bad AccountVisibility " + accountVisibility);
|
||||||
}
|
}
|
||||||
return false;
|
return currentUser.getCapabilities().canAdministrateServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<AccountGroup.UUID> groupsOf(Account.Id account) {
|
private Set<AccountGroup.UUID> groupsOf(Account.Id account) {
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ public class AccountsCollection implements
|
|||||||
IdentifiedUser user = _parse(id.get());
|
IdentifiedUser user = _parse(id.get());
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new ResourceNotFoundException(id);
|
throw new ResourceNotFoundException(id);
|
||||||
|
} else if (!accountControlFactory.get().canSee(user.getAccount())) {
|
||||||
|
throw new ResourceNotFoundException(id);
|
||||||
}
|
}
|
||||||
return new AccountResource(user);
|
return new AccountResource(user);
|
||||||
}
|
}
|
||||||
@@ -102,14 +104,7 @@ public class AccountsCollection implements
|
|||||||
if (matches.size() != 1) {
|
if (matches.size() != 1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return userFactory.create(Iterables.getOnlyElement(matches));
|
||||||
Account.Id a = Iterables.getOnlyElement(matches);
|
|
||||||
if (accountControlFactory.get().canSee(a)
|
|
||||||
|| user.getCapabilities().canAdministrateServer()) {
|
|
||||||
return userFactory.create(a);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user