Skip to content

Commit

Permalink
fix(rbac): csv updates no longer require server restarts (#1171)
Browse files Browse the repository at this point in the history
* fix(rbac): csv updates no longer require server restarts

* fix(rbac): address some of the sonarcloud issues

* fix(rbac): fix build error

* fix(rbac): address review suggestions

* fix(rbac): make reloading configurable
  • Loading branch information
PatAKnight authored Feb 12, 2024
1 parent 219aaa4 commit ed6fe65
Show file tree
Hide file tree
Showing 18 changed files with 1,618 additions and 266 deletions.
10 changes: 10 additions & 0 deletions plugins/rbac-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ permission:
policies-csv-file: /some/path/rbac-policy.csv
```

Also, there is an additional configuration value that allows for the reloading of the CSV file without the need to restart.

```YAML
permission:
enabled: true
rbac:
policies-csv-file: /some/path/rbac-policy.csv
policyFileReload: true
```

For more information on the available permissions within Showcase and RHDH, refer to the [permissions documentation](./docs/permissions.md).

### Configuring Database Storage for policies
Expand Down
5 changes: 5 additions & 0 deletions plugins/rbac-backend/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ export interface Config {
permission: {
rbac: {
'policies-csv-file'?: string;
/**
* Allow for reloading of the CSV file.
* @visibility frontend
*/
policyFileReload?: boolean;
/**
* Optional configuration for admins, can declare individual users and / or groups
* @visibility frontend
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
p, role:default/catalog-writer, catalog.entity.create, use, allow

p, role:default/catalog-writer, catalog.entity.create, use, deny
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
g, user:default/guest, role:default/catalog-deleter
g, user:default/guest, role:default/catalog-deleter

g, user:default/guest, role:default/catalog-updater

p, role:default/catalog-writer, catalog.entity.create, use, allow
p, role:default/catalog-writer, catalog.entity.create, use, allow

p, role:default/catalog-writer, catalog-entity, delete, allow
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
g, user:default/, role:default/catalog-deleter
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
p, role:default/, catalog.entity.create, use, allow
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
g, user:default/test, role:default/
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
g, user:default/guest, role:default/catalog-writer
g, user:default/guest, role:default/catalog-reader
g, user:default/guest, role:default/catalog-deleter

p, role:default/catalog-writer, catalog-entity, update, allow
p, role:default/catalog-writer, catalog-entity, read, allow
p, role:default/catalog-writer, catalog.entity.create, use, allow
p, role:default/catalog-deleter, catalog-entity, delete, deny

p, role:default/known_role, test.resource.deny, use, allow

g, user:default/known_user, role:default/known_role
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
g, user:default/guest, role:default/catalog-writer
g, user:default/guest, role:default/catalog-updater

g, user:default/guest, role:default/catalog-tester

p, role:default/catalog-writer, catalog-entity, update, allow
p, role:default/catalog-writer, catalog.entity.create, use, deny
p, role:default/catalog-deleter, catalog-entity, delete, allow

p, role:default/catalog-writer, catalog.entity.delete, delete, allow
Loading

0 comments on commit ed6fe65

Please sign in to comment.