def refund_enable(transaction, user): """ Returns True if *user* is able to trigger a refund on *transaction*. """ event = transaction.get_event() if event: return _valid_manager(user, [event.provider]) return False
def refund_enable(transaction, user): """ Returns True if *user* is able to trigger a refund on *transaction*. """ subscription = Subscription.objects.filter(pk=transaction.event_id).first() if subscription: return _valid_manager(user, [subscription.plan.organization]) return False
def fail_edit_perm(request, account=None): """ Returns ``True`` if the request user does not have edit permissions. """ result = True # The context processor will be called from the e-mail sender # which might not be associated to a request. if request is not None: if account is None: account = get_current_app().account result = not bool(_valid_manager(request, [account])) return result
def get_disabled_authentication(request): app = get_current_app() return (app.authentication == app.AUTH_DISABLED and not _valid_manager(request, [get_current_broker()]))
def is_manager(request, organization): return _valid_manager( request.user, Organization.objects.filter(slug=organization))
def is_manager(request, organization): return _valid_manager(request.user, Organization.objects.filter(slug=organization))