mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-05 21:34:36 -04:00
Fixes for company token sanity
This commit is contained in:
parent
4d9065624b
commit
42adc4d897
@ -160,7 +160,9 @@ class CheckData extends Command
|
|||||||
|
|
||||||
private function checkCompanyTokens()
|
private function checkCompanyTokens()
|
||||||
{
|
{
|
||||||
CompanyUser::doesnthave('token')->cursor()->each(function ($cu) {
|
CompanyUser::whereDoesntHave('token', function ($query){
|
||||||
|
return $query->where('is_system', 1);
|
||||||
|
})->cursor()->each(function ($cu){
|
||||||
if ($cu->user) {
|
if ($cu->user) {
|
||||||
$this->logMessage("Creating missing company token for user # {$cu->user->id} for company id # {$cu->company->id}");
|
$this->logMessage("Creating missing company token for user # {$cu->user->id} for company id # {$cu->company->id}");
|
||||||
(new CreateCompanyToken($cu->company, $cu->user, 'System'))->handle();
|
(new CreateCompanyToken($cu->company, $cu->user, 'System'))->handle();
|
||||||
@ -170,6 +172,11 @@ class CheckData extends Command
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* checkOauthSanity
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function checkOauthSanity()
|
private function checkOauthSanity()
|
||||||
{
|
{
|
||||||
User::where('oauth_provider_id', '1')->cursor()->each(function ($user) {
|
User::where('oauth_provider_id', '1')->cursor()->each(function ($user) {
|
||||||
|
@ -377,7 +377,7 @@ class LoginController extends BaseController
|
|||||||
|
|
||||||
if (auth()->user()->company_users()->count() != auth()->user()->tokens()->distinct('company_id')->count()) {
|
if (auth()->user()->company_users()->count() != auth()->user()->tokens()->distinct('company_id')->count()) {
|
||||||
auth()->user()->companies->each(function ($company) {
|
auth()->user()->companies->each(function ($company) {
|
||||||
if (!CompanyToken::where('user_id', auth()->user()->id)->where('company_id', $company->id)->exists()) {
|
if (!CompanyToken::where('user_id', auth()->user()->id)->where('company_id', $company->id)->where('is_system',true)->exists()) {
|
||||||
(new CreateCompanyToken($company, auth()->user(), 'Google_O_Auth'))->handle();
|
(new CreateCompanyToken($company, auth()->user(), 'Google_O_Auth'))->handle();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -45,7 +45,6 @@ class SendEmail
|
|||||||
$this->reminder_template = $this->quote->calculateTemplate('quote');
|
$this->reminder_template = $this->quote->calculateTemplate('quote');
|
||||||
}
|
}
|
||||||
|
|
||||||
// $mo = new MailObject();
|
|
||||||
|
|
||||||
$this->quote->service()->markSent()->save();
|
$this->quote->service()->markSent()->save();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user