Extending the FileBasedSystemAccessControl to add additional help context #23108
Unanswered
kirkhansen
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey all,
I'll preface this with I'm a Java noob.
I recently tried to extend the FileBasedSystemAccessControl and config classes to add some functionality. Specifically, I wanted to display a URL to a website that can help users request access to tables they don't have access to.
The result is an access-control.properties file that looks like:
The result is SQL error messages that look like:
I ended up needing to copy a lot more files than I'd have originally thought or hoped due to some of the SPI methods having undeclared privacy, so outside packages can't call the methods directly. The end result was me being unable to use these classes as base classes to inject my functionality and instead copy everything out.
An example of this is the
CatalogSchemaAccessControlRule::toAnyCatalogPermissionsRule
calls within the FileBasedSystemAccessControl private constructor.Stepping out a bit, this is what I added to a custom FileBasedSystemAccessControl class: note the
help_text
variable.My original idea was to extend Trino's FileBasedSystemAccessControl, override this checkCanSelectFromColumns, call super.checkCanSelectFromColumns(), catch the AccessDenied exception, and re-raise it adding my help-text to it.
I actually needed to copy paste the entire implementation.
Is there a better way to inherit / delegate calls so we can use the built in logic without needing to maintain an entire copy of the access control business logic?
The classes I ended up needing to copy out verbatim were:
These are the ones that needed some slight modifications:
Beta Was this translation helpful? Give feedback.
All reactions