-
Notifications
You must be signed in to change notification settings - Fork 24
feat(api-server): support assigning multiple roles #1061
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,32 +186,16 @@ cluster.grants.grant(rdb, "add-custom-zone", f'node/{node_id}', "fwadm") | |
| cluster.grants.grant(rdb, "remove-custom-zone", f'node/{node_id}', "fwadm") | ||
| cluster.grants.grant(rdb, "add-rich-rules", f'node/{node_id}', "fwadm") | ||
| cluster.grants.grant(rdb, "remove-rich-rules", f'node/{node_id}', "fwadm") | ||
|
|
||
| cluster.grants.grant(rdb, "add-tun", f'node/{node_id}', "tunadm") | ||
| cluster.grants.grant(rdb, "remove-tun", f'node/{node_id}', "tunadm") | ||
|
Comment on lines
189
to
190
|
||
| cluster.grants.grant(rdb, "add-public-service", f'node/{node_id}', "tunadm") | ||
| cluster.grants.grant(rdb, "remove-public-service", f'node/{node_id}', "tunadm") | ||
| cluster.grants.grant(rdb, "add-custom-zone", f'node/{node_id}', "tunadm") | ||
| cluster.grants.grant(rdb, "remove-custom-zone", f'node/{node_id}', "tunadm") | ||
| cluster.grants.grant(rdb, "add-tun", f'node/{node_id}', "tunadm") | ||
| cluster.grants.grant(rdb, "remove-tun", f'node/{node_id}', "tunadm") | ||
|
|
||
| cluster.grants.grant(rdb, "add-rich-rules", f'node/{node_id}', "tunadm") | ||
| cluster.grants.grant(rdb, "remove-rich-rules", f'node/{node_id}', "tunadm") | ||
| cluster.grants.grant(rdb, "allocate-ports", f'node/{node_id}', "portsadm") | ||
| cluster.grants.grant(rdb, "deallocate-ports", f'node/{node_id}', "portsadm") | ||
| cluster.grants.grant(rdb, "allocate-ports", f'node/{node_id}', "fwadm,portsadm") | ||
| cluster.grants.grant(rdb, "deallocate-ports", f'node/{node_id}', "fwadm,portsadm") | ||
| cluster.grants.grant(rdb, "add-public-service", f'node/{node_id}', "fwadm,portsadm") | ||
| cluster.grants.grant(rdb, "remove-public-service", f'node/{node_id}', "fwadm,portsadm") | ||
| cluster.grants.grant(rdb, "add-custom-zone", f'node/{node_id}', "fwadm,portsadm") | ||
| cluster.grants.grant(rdb, "remove-custom-zone", f'node/{node_id}', "fwadm,portsadm") | ||
| cluster.grants.grant(rdb, "add-rich-rules", f'node/{node_id}', "fwadm,portsadm") | ||
| cluster.grants.grant(rdb, "remove-rich-rules", f'node/{node_id}', "fwadm,portsadm") | ||
| cluster.grants.grant(rdb, "allocate-ports", f'node/{node_id}', "tunadm,portsadm") | ||
| cluster.grants.grant(rdb, "deallocate-ports", f'node/{node_id}', "tunadm,portsadm") | ||
| cluster.grants.grant(rdb, "add-tun", f'node/{node_id}', "tunadm,portsadm") | ||
| cluster.grants.grant(rdb, "remove-tun", f'node/{node_id}', "tunadm,portsadm") | ||
| cluster.grants.grant(rdb, "add-public-service", f'node/{node_id}', "tunadm,portsadm") | ||
| cluster.grants.grant(rdb, "remove-public-service", f'node/{node_id}', "tunadm,portsadm") | ||
| cluster.grants.grant(rdb, "add-custom-zone", f'node/{node_id}', "tunadm,portsadm") | ||
| cluster.grants.grant(rdb, "remove-custom-zone", f'node/{node_id}', "tunadm,portsadm") | ||
|
|
||
| # Grant on cascade the owner role on the new node, to users with the owner | ||
| # role on cluster | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation has a critical issue with how multiple roles are stored and retrieved. The current approach doesn't work correctly for either of the two possible syntaxes:
Syntax 1:
org.nethserver.authorizations = node:fwadm,portsadm(comma-separated roles in a single authorization)node/1/roles/fwadm,portsadm, which doesn't exist since the compound role definitions were removed.Syntax 2:
org.nethserver.authorizations = node:fwadm node:portsadm(space-separated authorizations)HSET roles/module/X node/1 <role>, which overwrites the previous valueThe alter_user function in core/imageroot/usr/local/agent/pypkg/cluster/grants.py needs to be updated to:
Without this fix, modules cannot actually be granted multiple roles on the same target.