Added /api/v1/groups/N/hosts and /api/v1/groups/N/all_hosts/

This commit is contained in:
Michael DeHaan
2013-04-16 17:41:20 -04:00
parent 27ac9a206e
commit 5e6ad5a244
5 changed files with 140 additions and 0 deletions

View File

@@ -123,6 +123,11 @@ class BaseSubList(BaseList):
# now make sure we could have already attached the two together. If we could not have, raise an exception
# such that the transaction does not commit.
if main == obj:
# no attaching to yourself
raise PermissionDenied()
if self.__class__.parent_model != User:
if not self.__class__.parent_model.can_user_attach(request.user, main, obj, self.__class__.relationship):
raise PermissionDenied()