make CustomInvetoryScript a resource.

This commit is contained in:
Wayne Witzel III
2016-04-07 11:53:21 -04:00
parent a0fd546bdf
commit 4a41c0f3b4
3 changed files with 53 additions and 2 deletions

View File

@@ -1264,7 +1264,7 @@ class InventoryUpdate(UnifiedJob, InventorySourceOptions):
return True
class CustomInventoryScript(CommonModelNameNotUnique):
class CustomInventoryScript(CommonModelNameNotUnique, ResourceMixin):
class Meta:
app_label = 'main'
@@ -1285,6 +1285,27 @@ class CustomInventoryScript(CommonModelNameNotUnique):
on_delete=models.SET_NULL,
)
admin_role = ImplicitRoleField(
role_name='CustomInventory Administrator',
role_description='May manage this inventory',
parent_role='organization.admin_role',
permissions = {'all': True}
)
member_role = ImplicitRoleField(
role_name='CustomInventory Member',
role_description='May view but not modify this inventory',
parent_role='organization.member_role',
permissions = {'read': True}
)
auditor_role = ImplicitRoleField(
role_name='CustomInventory Auditor',
role_description='May view but not modify this inventory',
parent_role='organization.auditor_role',
permissions = {'read': True}
)
def get_absolute_url(self):
return reverse('api:inventory_script_detail', args=(self.pk,))