mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
commit
2fa2523f2b
@ -209,6 +209,8 @@ class UserController extends BaseController
|
||||
|
||||
$ct = CreateCompanyToken::dispatchNow($company, $user, $user_agent);
|
||||
|
||||
nlog("in the store method of the usercontroller class");
|
||||
|
||||
event(new UserWasCreated($user, auth()->user(), $company, Ninja::eventVars()));
|
||||
|
||||
return $this->itemResponse($user->fresh());
|
||||
@ -626,7 +628,7 @@ class UserController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach an existing user to a company.
|
||||
* Invite an existing user to a company.
|
||||
*
|
||||
* @OA\Post(
|
||||
* path="/api/v1/users/{user}/invite",
|
||||
@ -682,4 +684,59 @@ class UserController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Invite an existing user to a company.
|
||||
*
|
||||
* @OA\Post(
|
||||
* path="/api/v1/users/{user}/reconfirm",
|
||||
* operationId="inviteUserReconfirm",
|
||||
* tags={"users"},
|
||||
* summary="Reconfirm an existing user to a company",
|
||||
* description="Reconfirm an existing user from a company",
|
||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
||||
* @OA\Parameter(ref="#/components/parameters/include"),
|
||||
* @OA\Parameter(
|
||||
* name="user",
|
||||
* in="path",
|
||||
* description="The user hashed_id",
|
||||
* example="FD767dfd7",
|
||||
* required=true,
|
||||
* @OA\Schema(
|
||||
* type="string",
|
||||
* format="string",
|
||||
* ),
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=200,
|
||||
* description="Success response",
|
||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response=422,
|
||||
* description="Validation error",
|
||||
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
|
||||
*
|
||||
* ),
|
||||
* @OA\Response(
|
||||
* response="default",
|
||||
* description="Unexpected Error",
|
||||
* @OA\JsonContent(ref="#/components/schemas/Error"),
|
||||
* ),
|
||||
* )
|
||||
* @param ReconfirmUserRequest $request
|
||||
* @param User $user
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function reconfirm(ReconfirmUserRequest $request, User $user)
|
||||
{
|
||||
|
||||
$user->service()->invite($user->company());
|
||||
|
||||
return response()->json(['message' => ctrans('texts.confirmation_resent')], 200);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,6 @@ class ReconfirmUserRequest extends Request
|
||||
*/
|
||||
public function authorize() : bool
|
||||
{
|
||||
return auth()->user()->isAdmin();
|
||||
return auth()->user()->id == $this->user->id;
|
||||
}
|
||||
}
|
||||
|
@ -82,8 +82,10 @@ class CreateUser
|
||||
'settings' => null,
|
||||
]);
|
||||
|
||||
if(!Ninja::isSelfHost())
|
||||
if(!Ninja::isSelfHost()){
|
||||
nlog("in the create user class");
|
||||
event(new UserWasCreated($user, $user, $this->company, Ninja::eventVars()));
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class PaymentNotification implements ShouldQueue
|
||||
foreach ($payment->company->company_users as $company_user) {
|
||||
$user = $company_user->user;
|
||||
|
||||
$methods = $this->findUserEntityNotificationType($payment, $company_user, ['all_notifications']);
|
||||
$methods = $this->findUserEntityNotificationType($payment, $company_user, ['payment_success_all', 'all_notifications']);
|
||||
|
||||
if (($key = array_search('mail', $methods)) !== false) {
|
||||
unset($methods[$key]);
|
||||
@ -69,19 +69,8 @@ class PaymentNotification implements ShouldQueue
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
}
|
||||
|
||||
// $notification = new NewPaymentNotification($payment, $payment->company);
|
||||
// $notification->method = $methods;
|
||||
|
||||
// if ($user) {
|
||||
// $user->notify($notification);
|
||||
// }
|
||||
}
|
||||
|
||||
/*Company Notifications*/
|
||||
// if (isset($payment->company->slack_webhook_url)) {
|
||||
// Notification::route('slack', $payment->company->slack_webhook_url)
|
||||
// ->notify(new NewPaymentNotification($payment, $payment->company, true));
|
||||
// }
|
||||
|
||||
/*Google Analytics Track Revenue*/
|
||||
if (isset($payment->company->google_analytics_key)) {
|
||||
|
@ -165,6 +165,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
|
||||
|
||||
Route::post('users/bulk', 'UserController@bulk')->name('users.bulk')->middleware('password_protected');
|
||||
Route::post('/users/{user}/invite', 'UserController@invite')->middleware('password_protected');
|
||||
Route::post('/users/{user}/reconfirm', 'UserController@reconfirm');
|
||||
|
||||
Route::resource('webhooks', 'WebhookController');
|
||||
Route::post('webhooks/bulk', 'WebhookController@bulk')->name('webhooks.bulk');
|
||||
|
Loading…
Reference in New Issue
Block a user