Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Add programmatic role generation (1:1 for database, schema, table) #10

Open
spyglass-software opened this issue Feb 25, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@spyglass-software
Copy link
Contributor

spyglass-software commented Feb 25, 2023

Part of the Managed Roles feature.

Users should be able to define a high level policy like: "For each schema, I want an admin, editor, and viewer role for all current and future tables".

Proposed YAML

spyglass:
  managedRoles:
    schema:
      objects: ["table"]

Resulting Roles

Example for a database acme with schemas production and staging:

create role acme.production_all_tables_admin;
grant all privileges on all tables in schema acme.production to role acme.production_all_tables_admin;

create role acme.production_all_tables_editor;
grant {select, insert, update, delete} on all tables in schema acme.production to role acme.production_all_tables_editor;
grant {select, insert, update, delete} on future tables in schema acme.production to role acme.production_all_tables_editor;

create role acme.production_all_tables_viewer;
grant select on all tables in schema acme.production to role acme.production_all_tables_viewer;
grant select on future tables in schema acme.production to role acme.production_all_tables_viewer;

create role acme.staging_all_tables_admin;
...
create role acme.staging_all_tables_editor;
...
create role acme.staging_all_tables_viewer;
...

...
@spyglass-software spyglass-software added the enhancement New feature or request label Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant