Introduce scope_types in os-create-backup
oslo.policy introduced the scope_type feature which can control the access level at system-level and project-level. - https://docs.openstack.org/oslo.policy/latest/user/usage.html#setting-scope - http://specs.openstack.org/openstack/keystone-specs/specs/keystone/queens/system-scope.html Appropriate scope_type for nova case: - https://specs.openstack.org/openstack/nova-specs/specs/ussuri/approved/policy-defaults-refresh.html#scope This commit introduce scope_type for os-create-backup API policies as 'system' and 'project'. Also adds the test case with scope_type enabled and verify we pass and fail the policy check with expected context. Partial implement blueprint policy-defaults-refresh Change-Id: I0d526bfffe44b59a75d46e7377e705447a349b04
This commit is contained in:
@@ -23,15 +23,16 @@ BASE_POLICY_NAME = 'os_compute_api:os-create-backup'
|
||||
|
||||
create_backup_policies = [
|
||||
policy.DocumentedRuleDefault(
|
||||
BASE_POLICY_NAME,
|
||||
base.RULE_ADMIN_OR_OWNER,
|
||||
'Create a back up of a server',
|
||||
[
|
||||
name=BASE_POLICY_NAME,
|
||||
check_str=base.RULE_ADMIN_OR_OWNER,
|
||||
description='Create a back up of a server',
|
||||
operations=[
|
||||
{
|
||||
'method': 'POST',
|
||||
'path': '/servers/{server_id}/action (createBackup)'
|
||||
}
|
||||
])
|
||||
],
|
||||
scope_types=['system', 'project'])
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user