Add can_start to notification template access

This commit is contained in:
Aaron Tan 2016-09-20 23:38:05 -04:00
parent 9fe408c6f7
commit f68baadc39
2 changed files with 7 additions and 0 deletions

View File

@ -3677,6 +3677,7 @@ class NotificationTemplateTest(GenericAPIView):
model = NotificationTemplate
serializer_class = EmptySerializer
new_in_300 = True
is_job_start = True
def post(self, request, *args, **kwargs):
obj = self.get_object()

View File

@ -1641,6 +1641,12 @@ class NotificationTemplateAccess(BaseAccess):
def can_delete(self, obj):
return self.can_change(obj, None)
@check_superuser
def can_start(self, obj):
if obj.organization is None:
return False
return self.user in obj.organization.admin_role
class NotificationAccess(BaseAccess):
'''
I can see/use a notification if I have permission to