Merge "Implement secure RBAC for the floating ip port forwarding API"
This commit is contained in:
commit
128f5ca935
|
@ -10,11 +10,17 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import versionutils
|
||||
from oslo_policy import policy
|
||||
|
||||
from neutron.conf.policies import base
|
||||
|
||||
|
||||
DEPRECATED_REASON = """
|
||||
The floating IP port forwarding API now supports system scope and default
|
||||
roles.
|
||||
"""
|
||||
|
||||
COLLECTION_PATH = '/floatingips/{floatingip_id}/port_forwardings'
|
||||
RESOURCE_PATH = ('/floatingips/{floatingip_id}'
|
||||
'/port_forwardings/{port_forwarding_id}')
|
||||
|
@ -22,21 +28,32 @@ RESOURCE_PATH = ('/floatingips/{floatingip_id}'
|
|||
|
||||
rules = [
|
||||
policy.DocumentedRuleDefault(
|
||||
'create_floatingip_port_forwarding',
|
||||
base.RULE_ADMIN_OR_PARENT_OWNER,
|
||||
'Create a floating IP port forwarding',
|
||||
[
|
||||
name='create_floatingip_port_forwarding',
|
||||
check_str=base.policy_or(
|
||||
base.SYSTEM_ADMIN_OR_PROJECT_MEMBER,
|
||||
base.RULE_PARENT_OWNER),
|
||||
scope_types=['system', 'project'],
|
||||
description='Create a floating IP port forwarding',
|
||||
operations=[
|
||||
{
|
||||
'method': 'POST',
|
||||
'path': COLLECTION_PATH,
|
||||
},
|
||||
]
|
||||
],
|
||||
deprecated_rule=policy.DeprecatedRule(
|
||||
name='create_floatingip_port_forwarding',
|
||||
check_str=base.RULE_ADMIN_OR_PARENT_OWNER),
|
||||
deprecated_reason=DEPRECATED_REASON,
|
||||
deprecated_since=versionutils.deprecated.WALLABY
|
||||
),
|
||||
policy.DocumentedRuleDefault(
|
||||
'get_floatingip_port_forwarding',
|
||||
base.RULE_ADMIN_OR_PARENT_OWNER,
|
||||
'Get a floating IP port forwarding',
|
||||
[
|
||||
name='get_floatingip_port_forwarding',
|
||||
check_str=base.policy_or(
|
||||
base.SYSTEM_OR_PROJECT_READER,
|
||||
base.RULE_PARENT_OWNER),
|
||||
scope_types=['system', 'project'],
|
||||
description='Get a floating IP port forwarding',
|
||||
operations=[
|
||||
{
|
||||
'method': 'GET',
|
||||
'path': COLLECTION_PATH,
|
||||
|
@ -45,29 +62,50 @@ rules = [
|
|||
'method': 'GET',
|
||||
'path': RESOURCE_PATH,
|
||||
},
|
||||
]
|
||||
],
|
||||
deprecated_rule=policy.DeprecatedRule(
|
||||
name='get_floatingip_port_forwarding',
|
||||
check_str=base.RULE_ADMIN_OR_PARENT_OWNER),
|
||||
deprecated_reason=DEPRECATED_REASON,
|
||||
deprecated_since=versionutils.deprecated.WALLABY
|
||||
),
|
||||
policy.DocumentedRuleDefault(
|
||||
'update_floatingip_port_forwarding',
|
||||
base.RULE_ADMIN_OR_PARENT_OWNER,
|
||||
'Update a floating IP port forwarding',
|
||||
[
|
||||
name='update_floatingip_port_forwarding',
|
||||
check_str=base.policy_or(
|
||||
base.SYSTEM_ADMIN_OR_PROJECT_MEMBER,
|
||||
base.RULE_PARENT_OWNER),
|
||||
scope_types=['system', 'project'],
|
||||
description='Update a floating IP port forwarding',
|
||||
operations=[
|
||||
{
|
||||
'method': 'PUT',
|
||||
'path': RESOURCE_PATH,
|
||||
},
|
||||
]
|
||||
],
|
||||
deprecated_rule=policy.DeprecatedRule(
|
||||
name='update_floatingip_port_forwarding',
|
||||
check_str=base.RULE_ADMIN_OR_PARENT_OWNER),
|
||||
deprecated_reason=DEPRECATED_REASON,
|
||||
deprecated_since=versionutils.deprecated.WALLABY
|
||||
),
|
||||
policy.DocumentedRuleDefault(
|
||||
'delete_floatingip_port_forwarding',
|
||||
base.RULE_ADMIN_OR_PARENT_OWNER,
|
||||
'Delete a floating IP port forwarding',
|
||||
[
|
||||
name='delete_floatingip_port_forwarding',
|
||||
check_str=base.policy_or(
|
||||
base.SYSTEM_ADMIN_OR_PROJECT_MEMBER,
|
||||
base.RULE_PARENT_OWNER),
|
||||
scope_types=['system', 'project'],
|
||||
description='Delete a floating IP port forwarding',
|
||||
operations=[
|
||||
{
|
||||
'method': 'DELETE',
|
||||
'path': RESOURCE_PATH,
|
||||
},
|
||||
]
|
||||
],
|
||||
deprecated_rule=policy.DeprecatedRule(
|
||||
name='delete_floatingip_port_forwarding',
|
||||
check_str=base.RULE_ADMIN_OR_PARENT_OWNER),
|
||||
deprecated_reason=DEPRECATED_REASON,
|
||||
deprecated_since=versionutils.deprecated.WALLABY
|
||||
),
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue