Merge "Use single quotes in image policies"
This commit is contained in:
commit
46fb37112c
glance
@ -26,12 +26,12 @@ PROJECT_READER = 'role:reader and project_id:%(project_id)s'
|
||||
IMAGE_MEMBER_CHECK = 'project_id:%(member_id)s'
|
||||
# Check if the visibility of the image supplied in the target matches
|
||||
# "community"
|
||||
COMMUNITY_VISIBILITY_CHECK = '"community":%(visibility)s'
|
||||
COMMUNITY_VISIBILITY_CHECK = "'community':%(visibility)s"
|
||||
# Check if the visibility of the resource supplied in the target matches
|
||||
# "public"
|
||||
PUBLIC_VISIBILITY_CHECK = '"public":%(visibility)s'
|
||||
PUBLIC_VISIBILITY_CHECK = "'public':%(visibility)s"
|
||||
# Check if the visibility of the image supplied in the target matches "shared"
|
||||
SHARED_VISIBILITY_CHECK = '"shared":%(visibility)s'
|
||||
SHARED_VISIBILITY_CHECK = "'shared':%(visibility)s"
|
||||
|
||||
PROJECT_MEMBER_OR_IMAGE_MEMBER_OR_COMMUNITY_OR_PUBLIC_OR_SHARED = (
|
||||
f'role:member and (project_id:%(project_id)s or {IMAGE_MEMBER_CHECK} '
|
||||
|
@ -1088,9 +1088,9 @@ class TestDefaultPolicyCheckStrings(base.IsolatedUnitTest):
|
||||
|
||||
def test_project_member_download_image_check_string(self):
|
||||
expected = (
|
||||
'role:member and (project_id:%(project_id)s or '
|
||||
'project_id:%(member_id)s or "community":%(visibility)s or '
|
||||
'"public":%(visibility)s or "shared":%(visibility)s)'
|
||||
"role:member and (project_id:%(project_id)s or "
|
||||
"project_id:%(member_id)s or 'community':%(visibility)s or "
|
||||
"'public':%(visibility)s or 'shared':%(visibility)s)"
|
||||
)
|
||||
self.assertEqual(
|
||||
expected,
|
||||
@ -1108,9 +1108,9 @@ class TestDefaultPolicyCheckStrings(base.IsolatedUnitTest):
|
||||
|
||||
def test_project_reader_get_image_check_string(self):
|
||||
expected = (
|
||||
'role:reader and (project_id:%(project_id)s or '
|
||||
'project_id:%(member_id)s or "community":%(visibility)s or '
|
||||
'"public":%(visibility)s or "shared":%(visibility)s)'
|
||||
"role:reader and (project_id:%(project_id)s or "
|
||||
"project_id:%(member_id)s or \'community\':%(visibility)s or "
|
||||
"'public':%(visibility)s or 'shared':%(visibility)s)"
|
||||
)
|
||||
self.assertEqual(
|
||||
expected,
|
||||
|
Loading…
x
Reference in New Issue
Block a user