Merge "Update attach_volume and detach_volume policy rules"

This commit is contained in:
Zuul 2018-06-04 07:41:39 +00:00 committed by Gerrit Code Review
commit 1770eda114
2 changed files with 5 additions and 4 deletions
openstack_dashboard/dashboards/project
instances
volumes

@ -893,7 +893,7 @@ class AttachVolume(tables.LinkAction):
url = "horizon:project:instances:attach_volume"
classes = ("ajax-modal",)
policy_rules = (
("compute", "os_compute_api:servers:create:attach_volume"),)
("compute", "os_compute_api:os-volumes-attachments:create"),)
# This action should be disabled if the instance
# is not active, or the instance is being deleted
@ -908,7 +908,8 @@ class DetachVolume(AttachVolume):
name = "detach_volume"
verbose_name = _("Detach Volume")
url = "horizon:project:instances:detach_volume"
policy_rules = (("compute", "os_compute_api:servers:detach_volume"),)
policy_rules = (
("compute", "os_compute_api:os-volumes-attachments:delete"),)
# This action should be disabled if the instance
# is not active, or the instance is being deleted

@ -188,12 +188,12 @@ class EditAttachments(tables.LinkAction):
project_id = getattr(volume, "os-vol-tenant-attr:tenant_id", None)
attach_allowed = \
policy.check((("compute",
"os_compute_api:servers:create:attach_volume"),),
"os_compute_api:os-volumes-attachments:create"),),
request,
{"project_id": project_id})
detach_allowed = \
policy.check((("compute",
"os_compute_api:servers:detach_volume"),),
"os_compute_api:os-volumes-attachments:delete"),),
request,
{"project_id": project_id})