Ability to remove hosts and inventory from groups.

This commit is contained in:
Michael DeHaan
2013-03-27 18:54:30 -04:00
parent 6e15d7a913
commit b8ee694d82
5 changed files with 55 additions and 24 deletions

View File

@@ -352,9 +352,12 @@ class Inventory(CommonModel):
@classmethod
def can_user_attach(cls, user, obj, sub_obj, relationship_type):
''' whether you can add sub_obj to obj using the relationship type in a subobject view '''
if type(sub_obj) != User:
if not sub_obj.can_user_read(user, sub_obj):
return False
if not sub_obj.can_user_read(user, sub_obj):
return False
return cls._has_permission_types(user, obj, PERMISSION_TYPES_ALLOWING_INVENTORY_WRITE)
@classmethod
def can_user_unattach(cls, user, obj, sub_obj, relationship):
return cls._has_permission_types(user, obj, PERMISSION_TYPES_ALLOWING_INVENTORY_WRITE)
@classmethod