Merge pull request #3546 from jangsutsr/3385_add_can_start_to_nt_temp

Add can_start to notification template access
This commit is contained in:
Aaron Tan 2016-09-21 09:03:38 -04:00 committed by GitHub
commit 2209a0e9e6
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