-
Notifications
You must be signed in to change notification settings - Fork 78
Acl #1628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
pirlgon
wants to merge
14
commits into
master
Choose a base branch
from
acl
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Acl #1628
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ac113b1
Create table application.acl
pirlgon 4fdac71
Introduces class TRN
pirlgon f7764dd
Execute ruff only on staged files
pirlgon fdc6331
Rename from AuthMiddleware to AuthenticationMiddleware
pirlgon 2450599
Add AclRule model
pirlgon 6a9bb9d
Add trn methods on models
pirlgon ee67abe
Make InstanceMiddleware global
pirlgon 42f8e97
flask: Authorization middleware
pirlgon 500d28b
flask: Remove anonymous_allowed decorator
pirlgon 6d9b7db
flask: Remove admin_required decorator
pirlgon 79c22e6
flask: Remove apikey_allowed decorator
pirlgon c40bc9d
tornado: AuthorizationsHelper
pirlgon 982ef08
Synchronise ACL and environment
pirlgon 81d386a
test: Wait for the 'Remove Member' modal to appear
pirlgon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| ------------------------------------------------ | ||
| -- ACL MANAGEMENT -- | ||
| ------------------------------------------------ | ||
| CREATE TABLE application.acl ( | ||
| "id" BIGSERIAL PRIMARY KEY, | ||
| "role" TEXT NOT NULL, | ||
| "action" TEXT NOT NULL, | ||
| "resource" TEXT NOT NULL, | ||
| "deny" BOOLEAN DEFAULT FALSE, | ||
| "cdate" TIMESTAMP WITH TIME ZONE DEFAULT NOW(), | ||
| "origin" TEXT, | ||
| UNIQUE("role", "action", "resource") | ||
| ); | ||
|
|
||
| INSERT INTO | ||
| application.acl (role, action, resource) | ||
| VALUES | ||
| -- All users can access root | ||
| ( | ||
| 'trn:temboard:*:*:*', | ||
| 'GET:/', | ||
| '*' | ||
|
pgiraud marked this conversation as resolved.
|
||
| ), | ||
| -- All users can access login page | ||
| ( | ||
| 'trn:temboard:*:*:*', | ||
| '*:/login', | ||
| '*' | ||
| ), | ||
| -- All users can submit login form | ||
| ( | ||
| 'trn:temboard:*:*:*', | ||
| '*:/json/login', | ||
| '*' | ||
| ), | ||
| -- All users can access reset password page | ||
| ( | ||
| 'trn:temboard:*:*:*', | ||
| '*:/reset-password', | ||
| '*' | ||
| ), | ||
| -- All users can submit reset-password form | ||
| ( | ||
| 'trn:temboard:*:*:*', | ||
| 'POST:/json/reset-password', | ||
| '*' | ||
| ), | ||
| -- All identified users can access logout | ||
| ( | ||
| 'trn:temboard:core:user:*', | ||
| '*:/logout', | ||
| '*' | ||
| ), | ||
| -- All identified users can access home | ||
| ( | ||
| 'trn:temboard:core:user:*', | ||
| '*:/home', | ||
| '*' | ||
| ), | ||
| -- All identified users can retrieve instances list | ||
| ( | ||
| 'trn:temboard:core:user:*', | ||
| 'GET:/json/instances/home', | ||
| '*' | ||
| ), | ||
| -- All identified user can access about page | ||
| ( | ||
| 'trn:temboard:core:user:*', | ||
| '*:/about', | ||
| '*' | ||
| ), | ||
| -- All users from admins group have access to ALL requests | ||
| ( | ||
| 'trn:temboard:core:group:admins', | ||
| '*', | ||
| '*' | ||
| ), | ||
| -- ApiKey have access to open metrics | ||
| ( | ||
| 'trn:temboard:core:apikey:*', | ||
| 'GET:/proxy/<address>/<port>/monitoring/metrics', | ||
| '*' | ||
| ); | ||
|
|
||
| -- Insert ACL for all existing dba groups | ||
| -- e.g. : mass/dba => "trn:temboard:core:group:mass/dba" "*" "trn:temboard:core:instance:mass" | ||
| INSERT INTO | ||
| application.acl (role, action, resource) | ||
| SELECT | ||
| 'trn:temboard:core:group:' || g.name AS group, | ||
| '*' AS action, | ||
| 'trn:temboard:core:instance:' || e.name AS instance | ||
| FROM | ||
| application.groups g | ||
| JOIN application.environments e ON g.id = e.dba_group_id; | ||
|
|
||
| -- Create group admins | ||
| INSERT INTO | ||
| application.groups (name, description) | ||
| VALUES | ||
| ('admins', 'Admin'); | ||
|
|
||
| --Add every user having is_admin to true in admins group | ||
| INSERT INTO | ||
| application.memberships (role_name, group_id) | ||
| SELECT | ||
| r.role_name, | ||
| ( | ||
| SELECT | ||
| id | ||
| FROM | ||
| application.groups | ||
| WHERE | ||
| name = 'admins' | ||
| ) | ||
| FROM | ||
| application.roles r | ||
| WHERE | ||
| r.is_admin; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.