liangyouze opened a new issue, #12269:
URL: https://github.com/apache/gravitino/issues/12269
### Version
main branch
### Describe what's wrong
- If a user is the owner of a catalog only, they can grant privileges on a
schema under that catalog (e.g. `grantPrivilegeToRole`).
- But if the same user is the owner of both the catalog and the schema (with
no explicit `USE_CATALOG` privilege), the same operation on the schema is
denied with 403.
The user with more ownership gets denied, which is inconsistent.
### Error message and/or stacktrace
403 Forbidden: "Current user can not grant privilege to role."
### How to reproduce
main branch, `gravitino.authorization.enable = true`
1. Create user `user1` with no explicit privileges.
2. Set `user1` as the owner of catalog `c1` and schema `c1.s1`.
3. As `user1`, call `PUT
/api/metalakes/{metalake}/permissions/roles/role1/SCHEMA/c1.s1/grant`.
Actual: 403 Forbidden.
Expected: allowed, since owning only the catalog (skip the schema
ownership in step 2) is sufficient for the same call.
### Additional context
In `JcasbinAuthorizer#hasSetOwnerPermission`, when the owner check matches
at
the schema level, the method returns early on the `USE_CATALOG` check and
never
walks up to the catalog level.
--
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]