Skip to content

[API] Add five permission values and grant targets - #2091

Merged
yili-db merged 1 commit into
unitycatalog:mainfrom
timothyw553:stack/permission-enums
Nov 3, 2026
Merged

yili-db merged 1 commit into
unitycatalog:mainfrom
timothyw553:stack/permission-enums

Conversation

@timothyw553

@timothyw553 timothyw553 commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

🥞 Stacked PR

Use this link to review incremental changes.


PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added or modified a feature, documentation in docs is updated

Description of changes

Add BROWSE, MANAGE, WRITE VOLUME, CREATE MODEL VERSION, and READ METADATA to the API and server enums. Validate where each permission can be granted. The child PRs add the authorization checks for each permission.

Before

With authorization enabled, the owner of main.public.sales tries to grant an existing user metadata access:

PATCH /api/2.1/unity-catalog/permissions/table/main.public.sales
Content-Type: application/json

{"changes": [{"principal": "[email protected]", "add": ["READ METADATA"]}]}

The API rejects the request because READ METADATA is not a recognized privilege.

After

The owner repeats the same request:

PATCH /api/2.1/unity-catalog/permissions/table/main.public.sales
Content-Type: application/json

{"changes": [{"principal": "[email protected]", "add": ["READ METADATA"]}]}

The API accepts and saves the grant. It also accepts BROWSE, MANAGE, WRITE VOLUME, and CREATE MODEL VERSION on their supported object types. For example, BROWSE is valid on a catalog or external location and is rejected on a table.

The child PRs add the authorization checks that make these grants affect metadata reads, grant changes, and credential requests.

This is the shared parent for #2084, #2085, #2086, #2087, and #2088.

Validation: 21 focused enum and permission tests passed on JDK 17. API generation, Java formatting, and server Compile/Test Checkstyle passed.

case READ_FILES, WRITE_FILES, CREATE_EXTERNAL_TABLE ->
Set.of(EXTERNAL_LOCATION, CREDENTIAL);
case CREATE_EXTERNAL_VOLUME, CREATE_MANAGED_STORAGE -> Set.of(EXTERNAL_LOCATION);
case BROWSE, MANAGE, WRITE_VOLUME, CREATE_MODEL_VERSION, READ_METADATA -> Set.of();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either add a //TODO, or just add the correct list of securable types.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ill add the securables mapping here

@timothyw553 timothyw553 changed the title [API] Add five permission enum values [API] Add five permission values and grant targets Oct 29, 2026
@timothyw553
timothyw553 force-pushed the stack/permission-enums branch from 255f8f1 to abfb57a Compare October 29, 2026 23:59
@yili-db

yili-db commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

/review

@timothyw553
timothyw553 force-pushed the stack/permission-enums branch 2 times, most recently from f74309a to 6f99227 Compare October 30, 2026 00:35
case TABLE -> Set.of(Privilege.SELECT, Privilege.MODIFY, Privilege.MANAGE);
case FUNCTION -> Set.of(Privilege.EXECUTE, Privilege.MANAGE);
case REGISTERED_MODEL ->
Set.of(Privilege.EXECUTE, Privilege.CREATE_MODEL_VERSION, Privilege.MANAGE);

@timothyw553 timothyw553 Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its ugly but the alternative is:

case REGISTERED_MODEL ->
  Set.of(Privilege.EXECUTE, //
         Privilege.CREATE_MODEL_VERSION, //
         Privilege.MANAGE);

@timothyw553
timothyw553 requested a review from yili-db October 30, 2026 03:44
@yili-db

yili-db commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

This PR needs @tdas approval for api/all.yaml

@timothyw553
timothyw553 force-pushed the stack/permission-enums branch from 6f99227 to 9f6b2ba Compare October 31, 2026 21:56

@tdas tdas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on yaml change

@yili-db
yili-db merged commit 49971c9 into unitycatalog:main Nov 3, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants