from nodeconductor.core.permissions import FilteredCollaboratorsPermissionLogic, StaffPermissionLogic
from nodeconductor.structure.models import ProjectRole


PERMISSION_LOGICS = (
    ('iaas.Instance', FilteredCollaboratorsPermissionLogic(
        collaborators_query='project__roles__permission_group__user',
        collaborators_filter={
            'project__roles__role_type': ProjectRole.ADMINISTRATOR,
        },

        any_permission=True,
    )),
    ('iaas.Template', StaffPermissionLogic(any_permission=True)),
    ('iaas.TemplateMapping', StaffPermissionLogic(any_permission=True)),
    ('iaas.Image', StaffPermissionLogic(any_permission=True)),
    ('iaas.TemplateLicense', StaffPermissionLogic(any_permission=True)),

)

from nodeconductor.core.permissions import FilteredCollaboratorsPermissionLogic, StaffPermissionLogic
from nodeconductor.structure.models import ProjectRole


PERMISSION_LOGICS = (
    ('iaas.Instance', FilteredCollaboratorsPermissionLogic(
        collaborators_query='project__roles__permission_group__user',
        collaborators_filter={
            'project__roles__role_type': ProjectRole.ADMINISTRATOR,
        },

        any_permission=True,
    )),
    ('iaas.Template', StaffPermissionLogic(any_permission=True)),
    ('iaas.TemplateMapping', StaffPermissionLogic(any_permission=True)),
    ('iaas.Image', StaffPermissionLogic(any_permission=True)),
    ('iaas.TemplateLicense', StaffPermissionLogic(any_permission=True)),
    ('iaas.InstanceSlaHistory', StaffPermissionLogic(any_permission=True)),
)

Allow InstanceSlaHistory to be managed by staff
Allow InstanceSlaHistory to be managed by staff

  from nodeconductor.core.permissions import FilteredCollaboratorsPermissionLogic, StaffPermissionLogic
  from nodeconductor.structure.models import ProjectRole
  
  
  PERMISSION_LOGICS = (
      ('iaas.Instance', FilteredCollaboratorsPermissionLogic(
          collaborators_query='project__roles__permission_group__user',
          collaborators_filter={
              'project__roles__role_type': ProjectRole.ADMINISTRATOR,
          },
  
          any_permission=True,
      )),
      ('iaas.Template', StaffPermissionLogic(any_permission=True)),
      ('iaas.TemplateMapping', StaffPermissionLogic(any_permission=True)),
      ('iaas.Image', StaffPermissionLogic(any_permission=True)),
      ('iaas.TemplateLicense', StaffPermissionLogic(any_permission=True)),
- 
+     ('iaas.InstanceSlaHistory', StaffPermissionLogic(any_permission=True)),
  )
  
Allow InstanceSlaHistory to be managed by staff
## Code Before:
from nodeconductor.core.permissions import FilteredCollaboratorsPermissionLogic, StaffPermissionLogic
from nodeconductor.structure.models import ProjectRole


PERMISSION_LOGICS = (
    ('iaas.Instance', FilteredCollaboratorsPermissionLogic(
        collaborators_query='project__roles__permission_group__user',
        collaborators_filter={
            'project__roles__role_type': ProjectRole.ADMINISTRATOR,
        },

        any_permission=True,
    )),
    ('iaas.Template', StaffPermissionLogic(any_permission=True)),
    ('iaas.TemplateMapping', StaffPermissionLogic(any_permission=True)),
    ('iaas.Image', StaffPermissionLogic(any_permission=True)),
    ('iaas.TemplateLicense', StaffPermissionLogic(any_permission=True)),

)

## Instruction:
Allow InstanceSlaHistory to be managed by staff
## Code After:
from nodeconductor.core.permissions import FilteredCollaboratorsPermissionLogic, StaffPermissionLogic
from nodeconductor.structure.models import ProjectRole


PERMISSION_LOGICS = (
    ('iaas.Instance', FilteredCollaboratorsPermissionLogic(
        collaborators_query='project__roles__permission_group__user',
        collaborators_filter={
            'project__roles__role_type': ProjectRole.ADMINISTRATOR,
        },

        any_permission=True,
    )),
    ('iaas.Template', StaffPermissionLogic(any_permission=True)),
    ('iaas.TemplateMapping', StaffPermissionLogic(any_permission=True)),
    ('iaas.Image', StaffPermissionLogic(any_permission=True)),
    ('iaas.TemplateLicense', StaffPermissionLogic(any_permission=True)),
    ('iaas.InstanceSlaHistory', StaffPermissionLogic(any_permission=True)),
)
