1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Feature permissions for hosted

This commit is contained in:
David Bomba 2021-03-08 08:32:38 +11:00
parent d55664d84b
commit e39ce7491b
11 changed files with 45 additions and 1 deletions

View File

@ -24,6 +24,7 @@ use App\Http\Requests\Client\UpdateClientRequest;
use App\Http\Requests\Client\UploadClientRequest; use App\Http\Requests\Client\UploadClientRequest;
use App\Jobs\Client\StoreClient; use App\Jobs\Client\StoreClient;
use App\Jobs\Client\UpdateClient; use App\Jobs\Client\UpdateClient;
use App\Models\Account;
use App\Models\Client; use App\Models\Client;
use App\Repositories\ClientRepository; use App\Repositories\ClientRepository;
use App\Transformers\ClientTransformer; use App\Transformers\ClientTransformer;
@ -574,6 +575,9 @@ class ClientController extends BaseController
public function upload(UploadClientRequest $request, Client $client) public function upload(UploadClientRequest $request, Client $client)
{ {
if(!$this->checkFeature(Account::FEATURE_DOCUMENTS))
return $this->featureFailure();
if ($request->has('documents')) if ($request->has('documents'))
$this->saveDocuments($request->file('documents'), $client); $this->saveDocuments($request->file('documents'), $client);

View File

@ -26,6 +26,7 @@ use App\Jobs\Company\CreateCompanyPaymentTerms;
use App\Jobs\Company\CreateCompanyTaskStatuses; use App\Jobs\Company\CreateCompanyTaskStatuses;
use App\Jobs\Company\CreateCompanyToken; use App\Jobs\Company\CreateCompanyToken;
use App\Jobs\Ninja\RefundCancelledAccount; use App\Jobs\Ninja\RefundCancelledAccount;
use App\Models\Account;
use App\Models\Company; use App\Models\Company;
use App\Models\CompanyUser; use App\Models\CompanyUser;
use App\Repositories\CompanyRepository; use App\Repositories\CompanyRepository;
@ -559,6 +560,9 @@ class CompanyController extends BaseController
public function upload(UploadCompanyRequest $request, Company $company) public function upload(UploadCompanyRequest $request, Company $company)
{ {
if(!$this->checkFeature(Account::FEATURE_DOCUMENTS))
return $this->featureFailure();
if ($request->has('documents')) if ($request->has('documents'))
$this->saveDocuments($request->file('documents'), $company); $this->saveDocuments($request->file('documents'), $company);

View File

@ -26,6 +26,7 @@ use App\Http\Requests\Credit\UpdateCreditRequest;
use App\Http\Requests\Credit\UploadCreditRequest; use App\Http\Requests\Credit\UploadCreditRequest;
use App\Jobs\Entity\EmailEntity; use App\Jobs\Entity\EmailEntity;
use App\Jobs\Invoice\EmailCredit; use App\Jobs\Invoice\EmailCredit;
use App\Models\Account;
use App\Models\Client; use App\Models\Client;
use App\Models\Credit; use App\Models\Credit;
use App\Models\Invoice; use App\Models\Invoice;
@ -643,6 +644,9 @@ class CreditController extends BaseController
public function upload(UploadCreditRequest $request, Credit $credit) public function upload(UploadCreditRequest $request, Credit $credit)
{ {
if(!$this->checkFeature(Account::FEATURE_DOCUMENTS))
return $this->featureFailure();
if ($request->has('documents')) if ($request->has('documents'))
$this->saveDocuments($request->file('documents'), $credit); $this->saveDocuments($request->file('documents'), $credit);

View File

@ -22,6 +22,7 @@ use App\Http\Requests\Expense\ShowExpenseRequest;
use App\Http\Requests\Expense\StoreExpenseRequest; use App\Http\Requests\Expense\StoreExpenseRequest;
use App\Http\Requests\Expense\UpdateExpenseRequest; use App\Http\Requests\Expense\UpdateExpenseRequest;
use App\Http\Requests\Expense\UploadExpenseRequest; use App\Http\Requests\Expense\UploadExpenseRequest;
use App\Models\Account;
use App\Models\Expense; use App\Models\Expense;
use App\Repositories\ExpenseRepository; use App\Repositories\ExpenseRepository;
use App\Transformers\ExpenseTransformer; use App\Transformers\ExpenseTransformer;
@ -565,6 +566,9 @@ class ExpenseController extends BaseController
public function upload(UploadExpenseRequest $request, Expense $expense) public function upload(UploadExpenseRequest $request, Expense $expense)
{ {
if(!$this->checkFeature(Account::FEATURE_DOCUMENTS))
return $this->featureFailure();
if ($request->has('documents')) if ($request->has('documents'))
$this->saveDocuments($request->file('documents'), $expense); $this->saveDocuments($request->file('documents'), $expense);

View File

@ -23,6 +23,7 @@ use App\Http\Requests\Payment\ShowPaymentRequest;
use App\Http\Requests\Payment\StorePaymentRequest; use App\Http\Requests\Payment\StorePaymentRequest;
use App\Http\Requests\Payment\UpdatePaymentRequest; use App\Http\Requests\Payment\UpdatePaymentRequest;
use App\Http\Requests\Payment\UploadPaymentRequest; use App\Http\Requests\Payment\UploadPaymentRequest;
use App\Models\Account;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Payment; use App\Models\Payment;
use App\Repositories\PaymentRepository; use App\Repositories\PaymentRepository;
@ -729,6 +730,9 @@ class PaymentController extends BaseController
public function upload(UploadPaymentRequest $request, Payment $payment) public function upload(UploadPaymentRequest $request, Payment $payment)
{ {
if(!$this->checkFeature(Account::FEATURE_DOCUMENTS))
return $this->featureFailure();
if ($request->has('documents')) if ($request->has('documents'))
$this->saveDocuments($request->file('documents'), $payment); $this->saveDocuments($request->file('documents'), $payment);

View File

@ -20,6 +20,7 @@ use App\Http\Requests\Product\ShowProductRequest;
use App\Http\Requests\Product\StoreProductRequest; use App\Http\Requests\Product\StoreProductRequest;
use App\Http\Requests\Product\UpdateProductRequest; use App\Http\Requests\Product\UpdateProductRequest;
use App\Http\Requests\Product\UploadProductRequest; use App\Http\Requests\Product\UploadProductRequest;
use App\Models\Account;
use App\Models\Product; use App\Models\Product;
use App\Repositories\ProductRepository; use App\Repositories\ProductRepository;
use App\Transformers\ProductTransformer; use App\Transformers\ProductTransformer;
@ -534,6 +535,9 @@ class ProductController extends BaseController
public function upload(UploadProductRequest $request, Product $product) public function upload(UploadProductRequest $request, Product $product)
{ {
if(!$this->checkFeature(Account::FEATURE_DOCUMENTS))
return $this->featureFailure();
if ($request->has('documents')) if ($request->has('documents'))
$this->saveDocuments($request->file('documents'), $product); $this->saveDocuments($request->file('documents'), $product);

View File

@ -20,6 +20,7 @@ use App\Http\Requests\Project\ShowProjectRequest;
use App\Http\Requests\Project\StoreProjectRequest; use App\Http\Requests\Project\StoreProjectRequest;
use App\Http\Requests\Project\UpdateProjectRequest; use App\Http\Requests\Project\UpdateProjectRequest;
use App\Http\Requests\Project\UploadProjectRequest; use App\Http\Requests\Project\UploadProjectRequest;
use App\Models\Account;
use App\Models\Project; use App\Models\Project;
use App\Repositories\ProjectRepository; use App\Repositories\ProjectRepository;
use App\Transformers\ProjectTransformer; use App\Transformers\ProjectTransformer;
@ -559,6 +560,9 @@ class ProjectController extends BaseController
public function upload(UploadProjectRequest $request, Project $project) public function upload(UploadProjectRequest $request, Project $project)
{ {
if(!$this->checkFeature(Account::FEATURE_DOCUMENTS))
return $this->featureFailure();
if ($request->has('documents')) if ($request->has('documents'))
$this->saveDocuments($request->file('documents'), $project); $this->saveDocuments($request->file('documents'), $project);

View File

@ -26,6 +26,7 @@ use App\Http\Requests\Quote\StoreQuoteRequest;
use App\Http\Requests\Quote\UpdateQuoteRequest; use App\Http\Requests\Quote\UpdateQuoteRequest;
use App\Http\Requests\Quote\UploadQuoteRequest; use App\Http\Requests\Quote\UploadQuoteRequest;
use App\Jobs\Invoice\ZipInvoices; use App\Jobs\Invoice\ZipInvoices;
use App\Models\Account;
use App\Models\Client; use App\Models\Client;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Quote; use App\Models\Quote;
@ -775,6 +776,9 @@ class QuoteController extends BaseController
public function upload(UploadQuoteRequest $request, Quote $quote) public function upload(UploadQuoteRequest $request, Quote $quote)
{ {
if(!$this->checkFeature(Account::FEATURE_DOCUMENTS))
return $this->featureFailure();
if ($request->has('documents')) if ($request->has('documents'))
$this->saveDocuments($request->file('documents'), $quote); $this->saveDocuments($request->file('documents'), $quote);

View File

@ -21,6 +21,7 @@ use App\Http\Requests\RecurringInvoice\ShowRecurringInvoiceRequest;
use App\Http\Requests\RecurringInvoice\StoreRecurringInvoiceRequest; use App\Http\Requests\RecurringInvoice\StoreRecurringInvoiceRequest;
use App\Http\Requests\RecurringInvoice\UpdateRecurringInvoiceRequest; use App\Http\Requests\RecurringInvoice\UpdateRecurringInvoiceRequest;
use App\Http\Requests\RecurringInvoice\UploadRecurringInvoiceRequest; use App\Http\Requests\RecurringInvoice\UploadRecurringInvoiceRequest;
use App\Models\Account;
use App\Models\RecurringInvoice; use App\Models\RecurringInvoice;
use App\Repositories\RecurringInvoiceRepository; use App\Repositories\RecurringInvoiceRepository;
use App\Transformers\RecurringInvoiceTransformer; use App\Transformers\RecurringInvoiceTransformer;
@ -738,6 +739,9 @@ class RecurringInvoiceController extends BaseController
public function upload(UploadRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice) public function upload(UploadRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice)
{ {
if(!$this->checkFeature(Account::FEATURE_DOCUMENTS))
return $this->featureFailure();
if ($request->has('documents')) if ($request->has('documents'))
$this->saveDocuments($request->file('documents'), $recurring_invoice); $this->saveDocuments($request->file('documents'), $recurring_invoice);

View File

@ -22,6 +22,7 @@ use App\Http\Requests\Task\ShowTaskRequest;
use App\Http\Requests\Task\StoreTaskRequest; use App\Http\Requests\Task\StoreTaskRequest;
use App\Http\Requests\Task\UpdateTaskRequest; use App\Http\Requests\Task\UpdateTaskRequest;
use App\Http\Requests\Task\UploadTaskRequest; use App\Http\Requests\Task\UploadTaskRequest;
use App\Models\Account;
use App\Models\Task; use App\Models\Task;
use App\Repositories\TaskRepository; use App\Repositories\TaskRepository;
use App\Transformers\TaskTransformer; use App\Transformers\TaskTransformer;
@ -35,8 +36,8 @@ use Illuminate\Http\Response;
/** /**
* Class TaskController. * Class TaskController.
* @covers App\Http\Controllers\TaskController
*/ */
class TaskController extends BaseController class TaskController extends BaseController
{ {
use MakesHash; use MakesHash;
@ -569,6 +570,9 @@ class TaskController extends BaseController
public function upload(UploadTaskRequest $request, Task $task) public function upload(UploadTaskRequest $request, Task $task)
{ {
if(!$this->checkFeature(Account::FEATURE_DOCUMENTS))
return $this->featureFailure();
if ($request->has('documents')) if ($request->has('documents'))
$this->saveDocuments($request->file('documents'), $task); $this->saveDocuments($request->file('documents'), $task);

View File

@ -22,6 +22,7 @@ use App\Http\Requests\Vendor\ShowVendorRequest;
use App\Http\Requests\Vendor\StoreVendorRequest; use App\Http\Requests\Vendor\StoreVendorRequest;
use App\Http\Requests\Vendor\UpdateVendorRequest; use App\Http\Requests\Vendor\UpdateVendorRequest;
use App\Http\Requests\Vendor\UploadVendorRequest; use App\Http\Requests\Vendor\UploadVendorRequest;
use App\Models\Account;
use App\Models\Vendor; use App\Models\Vendor;
use App\Repositories\VendorRepository; use App\Repositories\VendorRepository;
use App\Transformers\VendorTransformer; use App\Transformers\VendorTransformer;
@ -569,6 +570,9 @@ class VendorController extends BaseController
public function upload(UploadVendorRequest $request, Vendor $vendor) public function upload(UploadVendorRequest $request, Vendor $vendor)
{ {
if(!$this->checkFeature(Account::FEATURE_DOCUMENTS))
return $this->featureFailure();
if ($request->has('documents')) if ($request->has('documents'))
$this->saveDocuments($request->file('documents'), $vendor); $this->saveDocuments($request->file('documents'), $vendor);