mirror of
https://github.com/google/nomulus
synced 2026-01-10 07:57:58 +00:00
Add administrator privileges to RDAP
RDAP filters some contact data when the request is not authenticated as coming from a user associated with the registrar owning the contact. This CL adds an exception for admin users, which for the App Engine Users API are defined as App Engine project viewers. This means that the registry team will always get all information when logged in. This will also be useful when building tools that use RDAP output. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=168293820
This commit is contained in:
@@ -150,20 +150,23 @@ public abstract class RdapActionBase implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
Optional<String> getLoggedInClientId() {
|
||||
RdapAuthorization getAuthorization() {
|
||||
if (!authResult.userAuthInfo().isPresent()) {
|
||||
return Optional.<String>absent();
|
||||
return RdapAuthorization.PUBLIC_AUTHORIZATION;
|
||||
}
|
||||
UserAuthInfo userAuthInfo = authResult.userAuthInfo().get();
|
||||
if (userAuthInfo.isUserAdmin()) {
|
||||
return RdapAuthorization.ADMINISTRATOR_AUTHORIZATION;
|
||||
}
|
||||
if (!sessionUtils.checkRegistrarConsoleLogin(request, userAuthInfo)) {
|
||||
return Optional.<String>absent();
|
||||
return RdapAuthorization.PUBLIC_AUTHORIZATION;
|
||||
}
|
||||
String clientId = sessionUtils.getRegistrarClientId(request);
|
||||
Optional<Registrar> registrar = Registrar.loadByClientIdCached(clientId);
|
||||
if (!registrar.isPresent()) {
|
||||
return Optional.<String>absent();
|
||||
return RdapAuthorization.PUBLIC_AUTHORIZATION;
|
||||
}
|
||||
return Optional.of(clientId);
|
||||
return RdapAuthorization.create(RdapAuthorization.Role.REGISTRAR, clientId);
|
||||
}
|
||||
|
||||
void validateDomainName(String name) {
|
||||
|
||||
Reference in New Issue
Block a user