-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Starred requests persistence #1219
Conversation
Are we still planning on having endpoints to add or remove one star at a time? |
@MattCCS as part of the implementation, I believe we also discussed adding the |
public void setUserSettings( | ||
@ApiParam("The user id to use") @QueryParam("userId") String userId, | ||
@ApiParam("The new settings") SingularityUserSettings settings) { | ||
userManager.updateUserSettings(SingularityValidator.encodeZkName(userId), settings); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this ZK encoding stuff should be inside UserManager
-- the point of it is to encapsulate away all ZK-related stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix.
private String getAuthUserId() { | ||
checkBadRequest(user.isPresent() && user.get().getName().isPresent(), "Singularity userId must be provided by auth"); | ||
return user.get().getName().get(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method needs some work:
- The error message isn't accurate because we're not using the
userId
query param anymore. - Being unauthenticated should return an Unauthorized response, not a Bad Request response. Use SingularityAuthorizationHelper as a guide here; it uses
checkUnauthorized(user.isPresent(), "Please log in to perform this action.");
for stuff like this. - It's using the
name
field of SingularityUser (Thomas Petr
) when it should be using theid
field (tpetr
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, my bad. So, should I be checking authEnabled
before I do the checkAuthorized()
call (as happens in SingularityAuthorizationHelper)? Or should I just be calling checkAuthorized()
every time?
@@ -2,6 +2,8 @@ | |||
|
|||
import static com.google.common.base.Preconditions.checkNotNull; | |||
|
|||
import javax.ws.rs.HEAD; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this came in from a merge conflict
@tpetr any problem with merging this one now? |
This PR enables "starred" Singularity requests to persist in Zookeeper, rather than be stored client-side, so clearing the cache or changing devices won't require re-starring.
/cc @ssalinas @tpetr