Skip to content

[Server] Add MANAGE permission - #2088

Merged
yili-db merged 9 commits into
unitycatalog:mainfrom
timothyw553:feat/manage-privilege
Nov 10, 2026
Merged

yili-db merged 9 commits into
unitycatalog:mainfrom
timothyw553:feat/manage-privilege

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

This lets an owner delegate object administration with MANAGE. For example, an owner can let Alice manage access to main.public.sales:

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

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

With USE CATALOG on main and USE SCHEMA on main.public, Alice can grant Bob SELECT without owning the table:

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

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

Managers can read full metadata and grants, change grants, update supported metadata, and delete supported objects. Catalog and schema grants also cover their children. Callers need usage grants above the scope where they hold MANAGE. The metastore does not support MANAGE.

Data credentials, model publishing, and creation still use their existing permission checks. Managers can grant themselves other privileges. Delegated managers need creation rights to rename catalogs, schemas, tables,
volumes, and models, including when strict checks are disabled.
They can rename external locations and credentials with MANAGE.

The implementation extends the existing authorization rules. API request formats and persistence code are unchanged.

Ownership transfer is the second PR in this stack: #2149. It depends on this PR.

Validation passed: 63 focused tests on H2 and 63 on MySQL 8. These cover authorization, grant handling, MANAGE, Iceberg credentials, and legacy rename rules. Java formatting and server/test Checkstyle also passed.

build/sbt javafmtAll server/checkstyle server/Test/checkstyle
build/sbt "server/testOnly io.unitycatalog.server.auth.decorator.UnityAccessEvaluatorTest io.unitycatalog.server.service.PermissionServiceTest io.unitycatalog.server.sdk.access.SdkManageAccessControlTest io.unitycatalog.server.sdk.access.SdkIcebergCredentialMigrationTest io.unitycatalog.server.sdk.access.SdkModelRenameLegacyAccessControlTest io.unitycatalog.server.sdk.access.SdkVolumeRenameLegacyAccessControlTest"

Related: #1823.

@timothyw553

Copy link
Copy Markdown
Collaborator Author

/review

@timothyw553
timothyw553 force-pushed the feat/manage-privilege branch from 126f95f to a801ac0 Compare October 29, 2026 23:37
@timothyw553
timothyw553 force-pushed the feat/manage-privilege branch 3 times, most recently from c6e4f21 to 0a073a8 Compare October 30, 2026 00:35
@timothyw553 timothyw553 changed the title [Server] Add MANAGE permission [not human reviewed][Server] Add MANAGE permission Oct 30, 2026
@timothyw553
timothyw553 force-pushed the feat/manage-privilege branch from 0a073a8 to b41a2d3 Compare October 31, 2026 21:56
yili-db pushed a commit that referenced this pull request Nov 3, 2026
## 🥞 Stacked PR
Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/2091/files) to
review incremental changes.
-
[**stack/permission-enums**](#2091)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2091/files)]
← _this PR_
-
[stack/feat/browse-privilege](#2087)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2087/files/9f6b2ba7bcb2d8179b0dea15094d180602f95723..8504f42cac04ea8cac31e3b86807530ba0144057)]
-
[stack/feat/create-model-version-privilege](#2085)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2085/files/9f6b2ba7bcb2d8179b0dea15094d180602f95723..8575d777673066ca569002d40f6eab19631c936f)]
-
[stack/feat/manage-privilege](#2088)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2088/files/9f6b2ba7bcb2d8179b0dea15094d180602f95723..b41a2d34cfad7af957d8fd9ebd5446d0a42cd74b)]
-
[stack/feat/read-metadata-privilege](#2086)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2086/files/9f6b2ba7bcb2d8179b0dea15094d180602f95723..dd162f6987b22700fca3b18ac5105cc261e19e6a)]
-
[stack/feat/write-volume-privilege](#2084)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2084/files/9f6b2ba7bcb2d8179b0dea15094d180602f95723..7112a998365fc1d322bae3f26f6ba00d9fefc39e)]

---------
**PR Checklist**

- [x] 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.
- [x] 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:

```http
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:

```http
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.

Signed-off-by: Timothy Wang <[email protected]>
@timothyw553
timothyw553 force-pushed the feat/manage-privilege branch from b41a2d3 to 9ed7ea4 Compare November 6, 2026 21:57
@timothyw553 timothyw553 changed the title [not human reviewed][Server] Add MANAGE permission [Server] Add MANAGE permission Nov 6, 2026
@timothyw553
timothyw553 force-pushed the feat/manage-privilege branch from 9ed7ea4 to bce3c2c Compare November 7, 2026 00:04
@timothyw553 timothyw553 mentioned this pull request Nov 7, 2026
4 tasks done
@timothyw553
timothyw553 marked this pull request as ready for review November 7, 2026 00:35
Comment on lines +25 to +30
* and catalog OWNER/MANAGE pass unconditionally; schema OWNER/MANAGE needs catalog {@code
* USE_CATALOG}; other callers need {@code USE_SCHEMA} + {@code USE_CATALOG} plus {@code OWNER},
* {@code MANAGE}, or {@code SELECT} on the table. With strict privilege checks disabled, {@code
* MODIFY} also permits metadata access. {@code READ_METADATA} at metastore or catalog scope needs
* no usage grants; schema scope needs {@code USE_CATALOG}, and table scope needs both usage
* grants.

@timothyw553 timothyw553 Nov 7, 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.

is the change in this comment basically just talking about also including MANAGE in some checks? based on the code changes, it just looks like we're adding MANAGE to authorization for some

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.

Yes. The policy change here is adding MANAGE alongside OWNER for table metadata access. The rest of the comment describes the existing rules.

Comment on lines +120 to +121
(#authorize(#principal, #catalog, USE_CATALOG) &&
#authorizeAny(#principal, #schema, OWNER, MANAGE))

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.

it doesnt fit on one line?

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.

This would be 106 characters on one line. Checkstyle limits lines to 100, so I kept the break.

Comment on lines +66 to +67
READ_FILES, WRITE_FILES, CREATE_EXTERNAL_TABLE, CREATE_EXTERNAL_VOLUME,
CREATE_MANAGED_STORAGE)

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.

this cant be on one line?

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.

I reduced it to two lines. A single line would be 177 characters; Checkstyle allows 100.

Comment on lines +200 to +201
(#authorize(#principal, #catalog, USE_CATALOG) &&
#authorizeAny(#principal, #schema, OWNER, MANAGE)) ||

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.

it cant be on one line?

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.

This branch would be 109 characters on one line, including ||. Checkstyle allows 100, so I kept the break.

Comment on lines +202 to +204
(#authorize(#principal, #catalog, USE_CATALOG) &&
#authorize(#principal, #schema, USE_SCHEMA) &&
#authorizeAny(#principal, #table, OWNER, MANAGE))

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.

oh i see its cascading... like this anyOf(OWNER, MANAGE) moves down from catalog to table.

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.

Yes. The three branches check OWNER or MANAGE at catalog, schema, and table scope. The schema branch also needs USE CATALOG. The table branch needs both USE CATALOG and USE SCHEMA.

Comment on lines +208 to +219
public static final String UPDATE_FUNCTION =
"""
#authorizeAny(#principal, #catalog, OWNER, MANAGE) ||
(#authorize(#principal, #catalog, USE_CATALOG) &&
#authorizeAny(#principal, #schema, OWNER, MANAGE)) ||
(#authorize(#principal, #catalog, USE_CATALOG) &&
#authorize(#principal, #schema, USE_SCHEMA) &&
#authorizeAny(#principal, #function, OWNER, MANAGE))
""";

/** Volume management. File access still requires its own privileges. */
public static final String UPDATE_VOLUME =

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.

why do we need to introduce UPDATE_FUNCTION, UPDATE_VOLUME, and UPDATE_REGISTERED_MODEL? its nice but im just wondering.

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.

Volumes and models reuse these checks across updates and deletes. Models also use the same check for version metadata. UPDATE_FUNCTION has one caller here; #2149 reuses it for ownership transfer.

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.

[AI Assisted] UPDATE_FUNCTION has two callers in this PR, not one: FunctionService.deleteFunction and PermissionService.updateFunctionAuthorization. Because it also gates grants, a later change to delete semantics would silently change who can grant. Would MANAGE_FUNCTION read more accurately, with the same for the volume, model, and table constants? At minimum, the Javadoc should say the constant also gates grants.

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.

Updated the comments to say these policies also control grant changes. I kept the existing constant names.

Comment on lines +106 to +112
(#new_name == null || #authorize(#principal, #catalog, OWNER) ||
#authorizeAny(#principal, #metastore, OWNER, CREATE_CATALOG))
""")
@AuthorizeResourceKey(METASTORE)
public HttpResponse updateCatalog(
@Param("name") @AuthorizeResourceKey(CATALOG) String name, UpdateCatalog updateCatalog) {
@Param("name") @AuthorizeResourceKey(CATALOG) String name,
@AuthorizeKey(key = "new_name") UpdateCatalog updateCatalog) {

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.

what? what is this new name thing?

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.

new_name is an existing request field for rename. @AuthorizeKey lets this check read it. A manager can update metadata with MANAGE, but a rename also needs metastore OWNER or CREATE CATALOG. Catalog owners keep their existing rename access.

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.

huh? you say its existing but we're adding it here.

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.

@AuthorizeKey is new here. My earlier reply referred to the request field, not the annotation.

Before this PR, {"new_name":"sales_new"} already renamed a catalog. The new annotation lets the permission check read that existing field.

We need it because a manager can edit a comment with MANAGE, while renaming also requires permission to create a catalog.

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.

ok im guessing rename was just not wired into these permissions rules...

Comment on lines +130 to +134
"("
+ AuthorizeExpressions.UPDATE_REGISTERED_MODEL
+ """
) &&
(#new_name == null ||

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.

wow this is a very ugly expression... oh i see its because the old vs new checks. what is the new vs old behaviour?

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.

Existing owners can still rename without a creation grant when strict checks are off. With strict checks on, rename also needs schema OWNER, or USE SCHEMA plus CREATE MODEL or CREATE FUNCTION. Managers must pass that creation check in both modes. The last branch preserves the old owner exception.

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.

i have no idea what you're saying.

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.

Take a model called fraud. Alice owns it. Bob has MANAGE on it. Both have USE CATALOG and USE SCHEMA.

Bob can send {"comment":"updated"}. To send {"new_name":"fraud_v2"}, he also needs creation permission, such as CREATE MODEL.

Alice already had rename access. An existing switch for stricter permission checks is called strict_privilege_checks in this expression. When it is false, Alice can rename without a create grant. When it is true, she must also pass the creation check.

The long branch that checks OWNER preserves Alice's access when that switch is off. Bob must pass the creation check in either mode.

Comment on lines +136 to +137
(#authorize(#principal, #schema, OWNER) ||
(#authorize(#principal, #schema, USE_SCHEMA) &&

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.

why not authorizeAny(OWNER, USE_SCHEMA)...? similarly below.

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.

Applied this to the model, volume, and table rename checks. I kept OWNER in both authorizeAny calls so schema owners still pass without a create grant.

@timothyw553
timothyw553 force-pushed the feat/manage-privilege branch from 6cc1b65 to 8538624 Compare November 7, 2026 01:37
@yili-db

yili-db commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

/review

@timothyw553

Copy link
Copy Markdown
Collaborator Author

/review

@yili-db yili-db left a comment

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.

[AI Assisted] Review of bd264af. Inline comments are on diff lines. Finding for api/all.yaml is outside the diff, so it is here: [AI Assisted] api/all.yaml:2753: This MANAGE description says it "does not grant data access, execution, or object creation." That holds only before a self-grant. Could we state the owner-equivalence rule once instead: MANAGE can do what an owner can do, except ownership transfer (#2149)? The updateCredential description also still reads "Updates a credential." and should mention MANAGE.

Comment thread docs/server/auth.md
### MANAGE

`MANAGE` permits full metadata and grant inspection, grant changes, supported metadata updates,
and deletion. Managers can grant themselves other privileges, including data access.

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.

[AI Assisted] Could we add these points to this section? (1) With strict-privilege-checks=false, MANAGE grants are still validated, so MANAGE on the metastore is rejected. (2) Renaming a catalog, schema, table, volume, or model with MANAGE needs the matching create privilege in both modes; the migration list shows volume and model rename as strict-only. (3) nit: the note that existing MANAGE grants become active after upgrade (line 264) does not apply, since MANAGE has not shipped in a release.

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.

Updated. The docs now explain that MANAGE validation and manager rename checks apply in both modes. I clarified the owner rename entries and removed the upgrade note.

"""
#authorize(#principal, #catalog, OWNER)
#authorizeAny(#principal, #catalog, OWNER, MANAGE) &&
(#new_name == null || #authorize(#principal, #catalog, OWNER) ||

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.

[AI Assisted] Could we add owner-path cases here? The new #new_name branches in updateCatalog and SchemaService.updateSchema have no test where the owner renames; the rename scenario only covers managers. Cases: a catalog owner renames with no create grant; a schema owner with USE CATALOG renames; a schema owner without USE CATALOG is denied.

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.

Added all three cases. The tests also check that renaming keeps the same object ID.

(#authorizeAny(#principal, #catalog, OWNER, USE_CATALOG) &&
#authorizeAny(#principal, #schema, OWNER, USE_SCHEMA) &&
#authorizeAny(#principal, #schema, OWNER, CREATE_MODEL, CREATE_FUNCTION)) ||
(!#strict_privilege_checks &&

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.

[AI Assisted] The !#strict_privilege_checks OWNER-only chain is copied here and in VolumeService.updateVolume (line 158). Both copies have to be removed together when #2024 lands. Could we move the chain into one named constant in AuthorizeExpressions, with the TODO(#2024), and reuse it in both?

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.

I’d keep this cleanup with #2024. The model and volume checks use different resource keys, so sharing the whole expression would need another expression fragment.

@@ -401,8 +394,16 @@ private HttpResponse updateAuthorization(
/** Validates additions only, so grants saved on invalid object types can still be removed. */
static void validateAddedPrivileges(

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.

[AI Assisted] nit: The two-argument validateAddedPrivileges overload is only used by PermissionServiceGrantValidationTest. Passing true from the test would drop the wrapper.

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.

I kept the overload. It lets tests use strict validation while the method that takes the flag stays private.

@Patch("/catalog/{name}")
@AuthorizeExpression(
"#authorize(#principal, #metastore, OWNER) || #authorize(#principal, #catalog, OWNER)")
"#authorize(#principal, #metastore, OWNER) || #authorizeAny(#principal, #catalog, OWNER,"

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.

[AI Assisted] nit: These string concatenations split a single expression at the 100-column limit (here, and at lines 322 and 333). The neighboring endpoints use text blocks, so a text block would match the file.

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.

I left this formatting unchanged to keep the update focused.

@timothyw553
timothyw553 force-pushed the feat/manage-privilege branch from bd264af to 29d5c03 Compare November 10, 2026 19:27
@timothyw553

Copy link
Copy Markdown
Collaborator Author

@yili-db, on the API documentation:

Updated the description to explain that managers can grant themselves other privileges, including data access. I kept the specific limits because managers still need creation rights for renames. I also documented credential update permissions.

@timothyw553
timothyw553 requested a review from yili-db November 10, 2026 21:04
@timothyw553

Copy link
Copy Markdown
Collaborator Author

/review

Delegate supported metadata and grant administration without changing
ownership. Keep ownership transfer in a follow-up change.

Signed-off-by: Timothy Wang <[email protected]>
@timothyw553
timothyw553 force-pushed the feat/manage-privilege branch from db995be to 7a014a7 Compare November 10, 2026 21:46
@yili-db

yili-db commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

/review

@tdas

tdas commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

yaml changes LGTM

@yili-db
yili-db merged commit c7242ae into unitycatalog:main Nov 10, 2026
20 checks passed
yili-db pushed a commit that referenced this pull request Nov 19, 2026
## 🥞 Stacked PR
Use this
[link](https://github.com/unitycatalog/unitycatalog/pull/2149/files) to
review incremental changes.
-
[stack/split/ownership-transfer-after-manage-20261106](#2149)
[[Files
changed](https://github.com/unitycatalog/unitycatalog/pull/2149/files)]

---------
**PR Checklist**

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

**Description of changes**

This adds ownership transfer for catalogs, schemas, tables and views,
functions, volumes, registered models, external locations, and storage
credentials. The new owner must be an existing user.

For example, an authorized owner or manager can transfer
`main.public.sales` to Bob:

```http
PATCH /api/2.1/unity-catalog/tables/main.public.sales
Content-Type: application/json

{"owner": "[email protected]"}
```

Tables and functions get ownership PATCH endpoints. Other supported
update requests gain missing owner fields or start saving the existing
owner field. Views, functions, and models can be transferred to oneself;
assigning another user requires a metastore administrator.

Upgrade note: v0.3.0 accepted `owner` on credential and external
location PATCH requests but ignored it. These requests now transfer
ownership when `owner` is set. Clients must omit `owner` when changing
only other fields, including clients that copy stored object fields into
update requests. No database migration is required.

Creation and transfer save the object owner field and its `OWNER` grant
in one database transaction. After creation, the server loads only the
saved `OWNER` grant for that object into its local permission cache. A
delayed create request cannot restore a former owner's grant. Concurrent
metadata edits preserve the current owner. After a transfer commits, the
server reloads its local permission cache. Validation failures leave the
permission cache unchanged. Other instances need
`server.authorization.policy-refresh=true` to detect changes. Concurrent
commits can leave the policy row count and maximum ID unchanged, so the
poll can miss a transfer until another detectable change or a restart.
The poll interval is not a guaranteed revocation deadline.

If the local reload fails, the request returns an error even though the
transfer may have committed. With native authorization, permission
checks on that instance deny every user, including metastore admins,
until a reload succeeds. Grant changes and grant listings also fail
while the cache is incomplete. A denied request retries the reload even
when policy refresh is disabled. Read the owner after recovery before
retrying a transfer.

Tests use real HTTP requests to transfer ownership for all eight
resource types. They check that the new owner can change grants, the
former owner cannot, and unrelated grants remain. They also cover
delayed creation, rejected transfers, rollback, restart, concurrent
changes, and failed reload recovery.

This builds on the MANAGE support merged in #2088.

API reference docs and UI types are regenerated from the API
specification. The UI file also picks up existing API definitions,
including staging tables and Delta commits, that were missing from the
generated file.

Validation: the full H2 server run reported 1,434 passing tests and one
lifecycle failure because a local server already used port 8080. All
nine lifecycle tests passed when rerun in a separate network namespace.
All 157 focused checks passed on both MySQL 8 and PostgreSQL 18. Java
formatting and server main/test Checkstyle passed. Release-upgrade tests
were not run locally.

```sh
build/sbt javafmtAll server/compileJavastyle server/Test/testJavastyle
python3.11 dev/run-tests.py -p 4 server/test
UC_TEST_DATABASE=MYSQL_8 python3.11 dev/run-tests.py -p 4 "server/testOnly io.unitycatalog.server.persist.OwnershipRepositoryTest io.unitycatalog.server.sdk.access.SdkManageAccessControlTest io.unitycatalog.server.service.PermissionServiceAuthorizationDisabledTest io.unitycatalog.server.auth.JCasbinAuthorizerTest io.unitycatalog.server.auth.JCasbinAuthorizerMultiInstanceTest io.unitycatalog.server.audit.AuditorTest io.unitycatalog.server.auth.OpaAuthorizerTest io.unitycatalog.server.sdk.access.SdkOpaAccessControlTest io.unitycatalog.server.auth.decorator.UnityAccessEvaluatorTest io.unitycatalog.server.sdk.access.SdkDeltaStagingTableAccessControlTest io.unitycatalog.server.sdk.access.SdkUCStagingTableAccessControlTest io.unitycatalog.server.sdk.access.SdkIcebergRestCatalogAccessControlTest"
UC_TEST_DATABASE=POSTGRES_18 python3.11 dev/run-tests.py -p 4 "server/testOnly io.unitycatalog.server.persist.OwnershipRepositoryTest io.unitycatalog.server.sdk.access.SdkManageAccessControlTest io.unitycatalog.server.service.PermissionServiceAuthorizationDisabledTest io.unitycatalog.server.auth.JCasbinAuthorizerTest io.unitycatalog.server.auth.JCasbinAuthorizerMultiInstanceTest io.unitycatalog.server.audit.AuditorTest io.unitycatalog.server.auth.OpaAuthorizerTest io.unitycatalog.server.sdk.access.SdkOpaAccessControlTest io.unitycatalog.server.auth.decorator.UnityAccessEvaluatorTest io.unitycatalog.server.sdk.access.SdkDeltaStagingTableAccessControlTest io.unitycatalog.server.sdk.access.SdkUCStagingTableAccessControlTest io.unitycatalog.server.sdk.access.SdkIcebergRestCatalogAccessControlTest"
```

Related: #1823.

---------

Signed-off-by: Timothy Wang <[email protected]>
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