use of com.google.gerrit.server.account.AccountLimits in project gerrit by GerritCodeReview.
the class GetCapabilities method apply.
@Override
public Response<Map<String, Object>> apply(AccountResource resource) throws RestApiException, PermissionBackendException {
permissionBackend.checkUsesDefaultCapabilities();
PermissionBackend.WithUser perm = permissionBackend.currentUser();
if (!self.get().hasSameAccountId(resource.getUser())) {
perm.check(GlobalPermission.ADMINISTRATE_SERVER);
perm = permissionBackend.absentUser(resource.getUser().getAccountId());
}
Map<String, Object> have = new LinkedHashMap<>();
for (GlobalOrPluginPermission p : perm.test(permissionsToTest())) {
have.put(globalOrPluginPermissionName(p), true);
}
AccountLimits limits = limitsFactory.create(resource.getUser());
addRanges(have, limits);
addPriority(have, limits);
return Response.ok(have);
}
Aggregations