mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Added auth check in subscription listeners
This commit is contained in:
parent
66fca98fa1
commit
88696c4eec
@ -24,29 +24,49 @@ class SubscriptionListener
|
||||
{
|
||||
public function createdClient(ClientWasCreated $event)
|
||||
{
|
||||
if ( ! Auth::check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer = new ClientTransformer(Auth::user()->account);
|
||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CLIENT, $event->client, $transformer);
|
||||
}
|
||||
|
||||
public function createdQuote(QuoteWasCreated $event)
|
||||
{
|
||||
if ( ! Auth::check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer = new InvoiceTransformer(Auth::user()->account);
|
||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
|
||||
}
|
||||
|
||||
public function createdPayment(PaymentWasCreated $event)
|
||||
{
|
||||
if ( ! Auth::check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer = new PaymentTransformer(Auth::user()->account);
|
||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_PAYMENT, $event->payment, $transformer, [ENTITY_CLIENT, ENTITY_INVOICE]);
|
||||
}
|
||||
|
||||
public function createdCredit(CreditWasCreated $event)
|
||||
{
|
||||
if ( ! Auth::check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CREDIT, $event->credit);
|
||||
}
|
||||
|
||||
public function createdInvoice(InvoiceWasCreated $event)
|
||||
{
|
||||
if ( ! Auth::check()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$transformer = new InvoiceTransformer(Auth::user()->account);
|
||||
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_INVOICE, $event->invoice, $transformer, ENTITY_CLIENT);
|
||||
}
|
||||
@ -55,7 +75,7 @@ class SubscriptionListener
|
||||
{
|
||||
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_VENDOR, $event->vendor);
|
||||
}
|
||||
|
||||
|
||||
public function createdExpense(ExpenseWasCreated $event)
|
||||
{
|
||||
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_EXPENSE, $event->expense);
|
||||
@ -69,11 +89,11 @@ class SubscriptionListener
|
||||
$manager = new Manager();
|
||||
$manager->setSerializer(new ArraySerializer());
|
||||
$manager->parseIncludes($include);
|
||||
|
||||
|
||||
$resource = new Item($entity, $transformer, $entity->getEntityType());
|
||||
$data = $manager->createData($resource)->toArray();
|
||||
|
||||
|
||||
Utils::notifyZapier($subscription, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user