
from django.utils.translation import ugettext_lazy as _

from openstack_auth import utils

import horizon

from django.conf import settings


class Admin(horizon.Dashboard):
    name = _("Admin")
    slug = "admin"

    if getattr(settings, 'POLICY_CHECK_FUNCTION', None):
        policy_rules = (('identity', 'admin_required'),
                        ('image', 'context_is_admin'),
                        ('volume', 'context_is_admin'),
                        ('compute', 'context_is_admin'),
                        ('network', 'context_is_admin'),
                        ('orchestration', 'context_is_admin'),
                        ('telemetry', 'context_is_admin'),)
    else:
        permissions = (tuple(utils.get_admin_permissions()),)

horizon.register(Admin)


from django.utils.translation import ugettext_lazy as _

from openstack_auth import utils

import horizon

from django.conf import settings


class Admin(horizon.Dashboard):
    name = _("Admin")
    slug = "admin"

    if getattr(settings, 'POLICY_CHECK_FUNCTION', None):
        policy_rules = (('identity', 'admin_required'),
                        ('image', 'context_is_admin'),
                        ('volume', 'context_is_admin'),
                        ('compute', 'context_is_admin'),
                        ('network', 'context_is_admin'),
                        ('orchestration', 'context_is_admin'),)
    else:
        permissions = (tuple(utils.get_admin_permissions()),)

horizon.register(Admin)

Remove broken telemetry policy check
Remove broken telemetry policy check

The reference to telemetry policy is no longer needed as well
as broken causing the admin dashboard to show up inappropriately.

Closes-Bug: #1643009
Change-Id: I07406f5d6c23b0fcc34df00a29b573ffc2c900e7

  
  from django.utils.translation import ugettext_lazy as _
  
  from openstack_auth import utils
  
  import horizon
  
  from django.conf import settings
  
  
  class Admin(horizon.Dashboard):
      name = _("Admin")
      slug = "admin"
  
      if getattr(settings, 'POLICY_CHECK_FUNCTION', None):
          policy_rules = (('identity', 'admin_required'),
                          ('image', 'context_is_admin'),
                          ('volume', 'context_is_admin'),
                          ('compute', 'context_is_admin'),
                          ('network', 'context_is_admin'),
-                         ('orchestration', 'context_is_admin'),
+                         ('orchestration', 'context_is_admin'),)
-                         ('telemetry', 'context_is_admin'),)
      else:
          permissions = (tuple(utils.get_admin_permissions()),)
  
  horizon.register(Admin)
  
Remove broken telemetry policy check
## Code Before:

from django.utils.translation import ugettext_lazy as _

from openstack_auth import utils

import horizon

from django.conf import settings


class Admin(horizon.Dashboard):
    name = _("Admin")
    slug = "admin"

    if getattr(settings, 'POLICY_CHECK_FUNCTION', None):
        policy_rules = (('identity', 'admin_required'),
                        ('image', 'context_is_admin'),
                        ('volume', 'context_is_admin'),
                        ('compute', 'context_is_admin'),
                        ('network', 'context_is_admin'),
                        ('orchestration', 'context_is_admin'),
                        ('telemetry', 'context_is_admin'),)
    else:
        permissions = (tuple(utils.get_admin_permissions()),)

horizon.register(Admin)

## Instruction:
Remove broken telemetry policy check
## Code After:

from django.utils.translation import ugettext_lazy as _

from openstack_auth import utils

import horizon

from django.conf import settings


class Admin(horizon.Dashboard):
    name = _("Admin")
    slug = "admin"

    if getattr(settings, 'POLICY_CHECK_FUNCTION', None):
        policy_rules = (('identity', 'admin_required'),
                        ('image', 'context_is_admin'),
                        ('volume', 'context_is_admin'),
                        ('compute', 'context_is_admin'),
                        ('network', 'context_is_admin'),
                        ('orchestration', 'context_is_admin'),)
    else:
        permissions = (tuple(utils.get_admin_permissions()),)

horizon.register(Admin)
