Пример #1
0
 def get_queryset(self):
     from organization.utils import current_org
     if current_org.can_admin_by(self.request.user):
         queryset = models.AmazonCredential.objects.all()
     else:
         queryset = self.request.user.user_credential.all()
     return queryset
Пример #2
0
 def has_permission(self, request, view):
     if not current_org:
         return False
     return super(IsOrgAdminOrAppUser, self).has_permission(request, view) \
         and (current_org.can_admin_by(request.user) or request.user.is_app)
Пример #3
0
 def has_permission(self, request, view):
     if not current_org:
         return False
     return super(IsOrgAdmin, self).has_permission(
         request, view) and current_org.can_admin_by(request.user)
Пример #4
0
 def can_admin_current_org(self):
     return current_org.can_admin_by(self)