Skip to content

Commit e8a04b6

Browse files
Jonher937priteau
authored andcommitted
Fix default admin_or_owner policy expression
By default not even an admin can use the get_summary endpoint with all_tenants=True or using a tenant_id parameter. This commit fixes that. This rule is now the same as how cinder defines admin_or_owner. Change-Id: I3e34927e8ab88f25d2975b4dbac89b52a7d94c98 (cherry picked from commit 2a985c9)
1 parent 93b9cd8 commit e8a04b6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cloudkitty/common/policies/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
check_str='role:admin'),
2626
policy.RuleDefault(
2727
name='admin_or_owner',
28-
check_str='is_admin:True or project_id:%(project_id)s'),
28+
check_str='is_admin:True or '
29+
'(role:admin and is_admin_project:True) or '
30+
'project_id:%(project_id)s'),
2931
policy.RuleDefault(
3032
name='default',
3133
check_str=UNPROTECTED)

doc/source/_static/cloudkitty.policy.yaml.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#"context_is_admin": "role:admin"
22

3-
#"admin_or_owner": "is_admin:True or project_id:%(project_id)s"
3+
#"admin_or_owner": "is_admin:True or (role:admin and is_admin_project:True) or project_id:%(project_id)s"
44

55
#"default": ""
66

@@ -45,7 +45,7 @@
4545
# GET /v1/info/config
4646
#"info:get_config": ""
4747

48-
# Reture the list of loaded modules in Cloudkitty.
48+
# Return the list of loaded modules in Cloudkitty.
4949
# LIST /v1/rating/modules
5050
#"rating:list_modules": "role:admin"
5151

0 commit comments

Comments
 (0)