Skip to content

[rest] Align view permission handling with table in RESTCatalog.#7641

Open
shyjsarah wants to merge 2 commits intoapache:masterfrom
shyjsarah:view-no-permission-exception
Open

[rest] Align view permission handling with table in RESTCatalog.#7641
shyjsarah wants to merge 2 commits intoapache:masterfrom
shyjsarah:view-no-permission-exception

Conversation

@shyjsarah
Copy link
Copy Markdown
Contributor

Purpose

Align view permission handling with table in RESTCatalog.

Currently, table operations in RESTCatalog catch ForbiddenException and throw TableNoPermissionException, but view operations
(getView, createView, dropView, renameView, alterView, listViews, etc.) do not handle ForbiddenException at all.

This PR adds:

  • ViewNoPermissionException in Catalog.java, mirroring TableNoPermissionException
  • ForbiddenException handling for all view operations in RESTCatalog
  • DatabaseNoPermissionException handling for list view operations (consistent with list table behavior)

Tests

  • Added testApiWhenViewNoPermission in RESTCatalogTest to verify that getView, dropView, renameView, and alterView throw
    ViewNoPermissionException when permission is revoked
  • Updated RESTCatalogServer to support noPermissionViews and return 403 for forbidden view operations

…r view operations in RESTCatalog

Align view permission handling with table in RESTCatalog by catching
ForbiddenException and throwing ViewNoPermissionException for all view
operations (get/create/drop/rename/alter/list).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shyjsarah shyjsarah force-pushed the view-no-permission-exception branch from a38da0c to 340c4df Compare April 14, 2026 03:53
@shyjsarah shyjsarah closed this Apr 14, 2026
@shyjsarah shyjsarah reopened this Apr 14, 2026
@shyjsarah shyjsarah closed this Apr 14, 2026
@shyjsarah shyjsarah reopened this Apr 14, 2026
The renameViewHandle has a separate code path from viewHandle and was
missing the noPermissionViews check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
/** Exception for trying to operate on the view that doesn't have permission. */
class ViewNoPermissionException extends RuntimeException {

private static final String MSG = "View %s has no permission. Cause by %s.";
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.

Caused

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.

2 participants