Decouple superuser from SessionMetadata

Superuser should only be settable via the tool (see []
which is merged in here but not diffbased, and which removes
the implicit superuser for CharlestonRoad). It is a property
of the request, not of the session (there are no sessions in the tool).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=125204707
This commit is contained in:
cgoldfeder 2016-06-17 14:48:46 -07:00 committed by Ben McIlwain
parent e359ab5f52
commit fd6c4888db
44 changed files with 80 additions and 136 deletions

View file

@ -49,9 +49,6 @@ public abstract class SessionMetadata {
/** The key used for looking up the current client id on the session object. */
protected static final String CLIENT_ID_KEY = "CLIENT_ID";
/** The key used for looking up the superuser bit on the session object. */
protected static final String SUPERUSER_KEY = "SUPERUSER";
/** The key used for looking up the service extensions on the session object. */
protected static final String SERVICE_EXTENSIONS_KEY = "SERVICE_EXTENSIONS";
@ -93,10 +90,6 @@ public abstract class SessionMetadata {
return getProperty(String.class, CLIENT_ID_KEY);
}
public boolean isSuperuser() {
return Boolean.TRUE.equals(getProperty(Boolean.class, SUPERUSER_KEY));
}
@SuppressWarnings("unchecked")
public Set<String> getServiceExtensionUris() {
return getProperty(Set.class, SERVICE_EXTENSIONS_KEY);
@ -116,10 +109,6 @@ public abstract class SessionMetadata {
setPropertyChecked(CLIENT_ID_KEY, clientId);
}
public void setSuperuser(boolean superuser) {
setPropertyChecked(SUPERUSER_KEY, superuser);
}
public void setServiceExtensionUris(Set<String> serviceExtensionUris) {
setPropertyChecked(SERVICE_EXTENSIONS_KEY, checkNotNull(serviceExtensionUris));
}
@ -142,7 +131,6 @@ public abstract class SessionMetadata {
return toStringHelper(getClass())
.add("system hash code", System.identityHashCode(this))
.add("clientId", getClientId())
.add("isSuperuser", isSuperuser())
.add("failedLoginAttempts", getFailedLoginAttempts())
.add("sessionSource", getSessionSource())
.add("serviceExtensionUris", Joiner.on('.').join(nullToEmpty(getServiceExtensionUris())))