mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Inject RdapAuthorization
We currently create it from injected arguments, and pass it to every function. Instead, we just create a provider for it and inject it where needed. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=247072517
This commit is contained in:
parent
ce7456ea66
commit
3b8a8892bb
10 changed files with 70 additions and 102 deletions
|
@ -267,8 +267,7 @@ public class RdapEntitySearchAction extends RdapSearchActionBase {
|
|||
if (subtype == Subtype.REGISTRARS) {
|
||||
resultSet = RdapResultSet.create(ImmutableList.of());
|
||||
} else {
|
||||
RdapAuthorization authorization = getAuthorization();
|
||||
if ((authorization.role() == RdapAuthorization.Role.PUBLIC)
|
||||
if ((rdapAuthorization.role() == RdapAuthorization.Role.PUBLIC)
|
||||
|| (cursorType == CursorType.REGISTRAR)) {
|
||||
resultSet = RdapResultSet.create(ImmutableList.of());
|
||||
} else {
|
||||
|
@ -280,8 +279,8 @@ public class RdapEntitySearchAction extends RdapSearchActionBase {
|
|||
cursorQueryString, // if we get this far, and there's a cursor, it must be a contact
|
||||
DeletedItemHandling.EXCLUDE,
|
||||
rdapResultSetMaxSize + 1);
|
||||
if (authorization.role() != RdapAuthorization.Role.ADMINISTRATOR) {
|
||||
query = query.filter("currentSponsorClientId in", authorization.clientIds());
|
||||
if (rdapAuthorization.role() != RdapAuthorization.Role.ADMINISTRATOR) {
|
||||
query = query.filter("currentSponsorClientId in", rdapAuthorization.clientIds());
|
||||
}
|
||||
resultSet = getMatchingResources(query, false, now, rdapResultSetMaxSize + 1);
|
||||
}
|
||||
|
@ -463,7 +462,7 @@ public class RdapEntitySearchAction extends RdapSearchActionBase {
|
|||
// There can be more results than our max size, partially because we have two pools to draw from
|
||||
// (contacts and registrars), and partially because we try to fetch one more than the max size,
|
||||
// so we can tell whether to display the truncation notification.
|
||||
RdapAuthorization authorization = getAuthorization();
|
||||
//
|
||||
// Each time we add a contact or registrar to the output data set, remember what the appropriate
|
||||
// cursor would be if it were the last item returned. When we stop adding items, the last cursor
|
||||
// value we remembered will be the right one to pass back.
|
||||
|
@ -479,8 +478,7 @@ public class RdapEntitySearchAction extends RdapSearchActionBase {
|
|||
Optional.empty(),
|
||||
rdapWhoisServer,
|
||||
now,
|
||||
outputDataType,
|
||||
authorization));
|
||||
outputDataType));
|
||||
newCursor =
|
||||
Optional.of(
|
||||
CONTACT_CURSOR_PREFIX
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue