Merge "Use permissions attribute to detect ironic service"
This commit is contained in:
commit
94d111fe2c
@ -17,28 +17,13 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
|
|
||||||
import horizon
|
import horizon
|
||||||
|
|
||||||
from openstack_dashboard.api import base
|
|
||||||
from openstack_dashboard.dashboards.admin import dashboard
|
from openstack_dashboard.dashboards.admin import dashboard
|
||||||
|
|
||||||
|
|
||||||
class Ironic(horizon.Panel):
|
class Ironic(horizon.Panel):
|
||||||
name = _("Ironic Bare Metal Provisioning")
|
name = _("Ironic Bare Metal Provisioning")
|
||||||
slug = 'ironic'
|
slug = 'ironic'
|
||||||
permissions = ('openstack.roles.admin',)
|
permissions = ('openstack.roles.admin', 'openstack.services.baremetal',)
|
||||||
|
|
||||||
def allowed(self, context):
|
|
||||||
request = context['request']
|
|
||||||
if not base.is_service_enabled(request, 'baremetal'):
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return super(Ironic, self).allowed(context)
|
|
||||||
|
|
||||||
def nav(self, context):
|
|
||||||
request = context['request']
|
|
||||||
if not base.is_service_enabled(request, 'baremetal'):
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
dashboard.Admin.register(Ironic)
|
dashboard.Admin.register(Ironic)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user