Copilot commented on code in PR #8384:
URL: https://github.com/apache/texera/pull/8384#discussion_r3998480628
##########
file-service/src/main/scala/org/apache/texera/service/resource/ResourceAccess.scala:
##########
@@ -323,6 +320,19 @@ object ResourceAccess {
)
}
+ /**
+ * Resolves an email to its user id, throwing BadRequestException (400)
when no registered
+ * account matches — the service registers no ExceptionMapper for
NullPointerException, so a
+ * bare dereference surfaces as an opaque HTTP 500. Shared by grant/revoke.
+ */
+ private def resolveUidByEmail(ctx: DSLContext, email: String): Integer = {
+ val user = new UserDao(ctx.configuration()).fetchOneByEmail(email)
+ if (user == null || user.getIsPlaceholder) {
+ throw new BadRequestException(s"No registered user with email $email")
Review Comment:
This refactor also changes `revoke` to reject placeholder accounts through
`getIsPlaceholder`, but the new revoke tests cover only the null-user branch.
Please add a placeholder-account revoke case for both dataset and model
resources (and verify no access row is created), so the advertised behavior is
protected on both endpoint paths.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]