示例#1
0
 def resolve_participants(self, info):
     user = info.context.user
     if not has_owner_permission(user, self.owner):
         return None
     if not self.ticket_product:
         return None
     tickets = self.ticket_product.ticket_set.filter(status=Ticket.STATUS_PAID)
     return [t.owner.profile for t in tickets]
示例#2
0
    def resolve_ticket(self, info, global_id=None, id=None):
        ticket = None
        if global_id:
            ticket = Ticket.objects.get(pk=from_global_id(global_id)[1])
        if id:
            ticket = Ticket.objects.get(pk=id)

        if not ticket:
            return None
        if not has_owner_permission(info.context.user, ticket.owner):
            raise PermissionDenied()
        return ticket
示例#3
0
 def resolve_organization(self, info):
     if has_owner_permission(info.context.user, self.user):
         return self.organization
     return ''
示例#4
0
 def resolve_phone(self, info):
     if has_owner_permission(info.context.user, self.user):
         return self.phone
     return ''
示例#5
0
 def resolve_email(self, info):
     if has_owner_permission(info.context.user, self.user):
         return self.email
     return ''
示例#6
0
 def resolve_slide_url(self, info):
     if timezone.now() > self.finished_at:
         return self.slide_url
     if has_owner_permission(info.context.user, self.owner):
         return self.slide_url
     return ''
示例#7
0
 def resolve_owner(self, info):
     if has_owner_permission(info.context.user, self.owner):
         return self.owner
     return None
示例#8
0
 def resolve_comment(self, info):
     if has_owner_permission(info.context.user, self.owner):
         return self.comment
     return ''