mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-22 16:23:18 +01:00
Apply Pint fixes
This commit is contained in:
parent
ca903b6fc0
commit
49fddfd331
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Api\v1\Controllers;
|
namespace App\Api\v1\Controllers;
|
||||||
|
|
||||||
use App\Api\v1\Requests\UserManagerStoreRequest;
|
|
||||||
use App\Api\v1\Requests\UserManagerPromoteRequest;
|
use App\Api\v1\Requests\UserManagerPromoteRequest;
|
||||||
|
use App\Api\v1\Requests\UserManagerStoreRequest;
|
||||||
use App\Api\v1\Resources\UserManagerResource;
|
use App\Api\v1\Resources\UserManagerResource;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
@ -63,11 +63,10 @@ public function resetPassword(Request $request, User $user)
|
|||||||
$response = $this->broker()->sendResetLink(
|
$response = $this->broker()->sendResetLink(
|
||||||
['email' => $credentials['email']]
|
['email' => $credentials['email']]
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'bad request',
|
'message' => 'bad request',
|
||||||
'reason' => is_string($response) ? __($response) : __('errors.no_pwd_reset_for_this_user_type')
|
'reason' => is_string($response) ? __($response) : __('errors.no_pwd_reset_for_this_user_type'),
|
||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +74,7 @@ public function resetPassword(Request $request, User $user)
|
|||||||
? new UserManagerResource($user)
|
? new UserManagerResource($user)
|
||||||
: response()->json([
|
: response()->json([
|
||||||
'message' => 'bad request',
|
'message' => 'bad request',
|
||||||
'reason' => __($response)
|
'reason' => __($response),
|
||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,5 +195,4 @@ protected function broker()
|
|||||||
{
|
{
|
||||||
return Password::broker();
|
return Password::broker();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public function rules()
|
|||||||
$rule = [
|
$rule = [
|
||||||
'value' => [
|
'value' => [
|
||||||
'required',
|
'required',
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($this->route()?->parameter('settingName') == 'restrictList') {
|
if ($this->route()?->parameter('settingName') == 'restrictList') {
|
||||||
|
@ -61,11 +61,10 @@ public function __construct($resource)
|
|||||||
$this->with = [
|
$this->with = [
|
||||||
'password_reset' => $password_reset,
|
'password_reset' => $password_reset,
|
||||||
'valid_personal_access_tokens' => $PATs_count,
|
'valid_personal_access_tokens' => $PATs_count,
|
||||||
'webauthn_credentials' => $this->resource->webAuthnCredentials()->count()
|
'webauthn_credentials' => $this->resource->webAuthnCredentials()->count(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the token has expired.
|
* Determine if the token has expired.
|
||||||
*
|
*
|
||||||
@ -75,7 +74,7 @@ public function __construct($resource)
|
|||||||
protected function tokenExpired($createdAt)
|
protected function tokenExpired($createdAt)
|
||||||
{
|
{
|
||||||
// See Illuminate\Auth\Passwords\DatabaseTokenRepository
|
// See Illuminate\Auth\Passwords\DatabaseTokenRepository
|
||||||
return Carbon::parse($createdAt)->addSeconds(config('auth.passwords.users.expires', 60)*60)->isPast();
|
return Carbon::parse($createdAt)->addSeconds(config('auth.passwords.users.expires', 60) * 60)->isPast();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -137,7 +137,7 @@ public function handle()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Runs the passport:install command silently
|
||||||
*/
|
*/
|
||||||
protected function installPassport() : void
|
protected function installPassport() : void
|
||||||
{
|
{
|
||||||
@ -147,7 +147,7 @@ protected function installPassport() : void
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Runs the config:cache command silently
|
||||||
*/
|
*/
|
||||||
protected function cacheConfig() : void
|
protected function cacheConfig() : void
|
||||||
{
|
{
|
||||||
@ -157,11 +157,11 @@ protected function cacheConfig() : void
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Runs the storage:link command silently
|
||||||
*/
|
*/
|
||||||
protected function createStorageLink() : void
|
protected function createStorageLink() : void
|
||||||
{
|
{
|
||||||
if (!file_exists(public_path('storage'))) {
|
if (! file_exists(public_path('storage'))) {
|
||||||
$this->components->task('Creating storage link', function () : void {
|
$this->components->task('Creating storage link', function () : void {
|
||||||
$this->callSilently('storage:link');
|
$this->callSilently('storage:link');
|
||||||
});
|
});
|
||||||
@ -169,7 +169,7 @@ protected function createStorageLink() : void
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Lets the user set the main environment variables
|
||||||
*/
|
*/
|
||||||
protected function setMainEnvVars() : void
|
protected function setMainEnvVars() : void
|
||||||
{
|
{
|
||||||
@ -177,8 +177,7 @@ protected function setMainEnvVars() : void
|
|||||||
$appUrl = trim($this->ask('URL of this 2FAuth instance', config('app.url')), '/');
|
$appUrl = trim($this->ask('URL of this 2FAuth instance', config('app.url')), '/');
|
||||||
if (filter_var($appUrl, FILTER_VALIDATE_URL)) {
|
if (filter_var($appUrl, FILTER_VALIDATE_URL)) {
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$this->components->error('This is not a valid URL, please retry');
|
$this->components->error('This is not a valid URL, please retry');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,7 +194,7 @@ protected function setMainEnvVars() : void
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompt user for valid database credentials and set them to .env file.
|
* Prompts user for valid database credentials and sets them to .env file.
|
||||||
*/
|
*/
|
||||||
protected function setDbEnvVars() : void
|
protected function setDbEnvVars() : void
|
||||||
{
|
{
|
||||||
@ -253,7 +252,7 @@ protected function setDbEnvVars() : void
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Runs db migration with --force option
|
||||||
*/
|
*/
|
||||||
protected function migrateDatabase() : mixed
|
protected function migrateDatabase() : mixed
|
||||||
{
|
{
|
||||||
@ -265,7 +264,7 @@ protected function migrateDatabase() : mixed
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Clears some caches
|
||||||
*/
|
*/
|
||||||
protected function clearCaches() : void
|
protected function clearCaches() : void
|
||||||
{
|
{
|
||||||
@ -276,7 +275,7 @@ protected function clearCaches() : void
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Loads the existing env file or creates it
|
||||||
*/
|
*/
|
||||||
protected function loadEnvFile() : void
|
protected function loadEnvFile() : void
|
||||||
{
|
{
|
||||||
@ -300,7 +299,7 @@ protected function loadEnvFile() : void
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Generates an app key if necessary
|
||||||
*/
|
*/
|
||||||
protected function maybeGenerateAppKey() : void
|
protected function maybeGenerateAppKey() : void
|
||||||
{
|
{
|
||||||
@ -317,7 +316,7 @@ protected function maybeGenerateAppKey() : void
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a random key for the application.
|
* Generates a random key for the application.
|
||||||
*/
|
*/
|
||||||
protected function generateRandomKey() : string
|
protected function generateRandomKey() : string
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
use App\Http\Requests\UserUpdateRequest;
|
use App\Http\Requests\UserUpdateRequest;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
@ -109,6 +109,4 @@ public function clear(Request $request)
|
|||||||
|
|
||||||
return response()->json(['exit-code' => $exitCode], 200);
|
return response()->json(['exit-code' => $exitCode], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
namespace App\Listeners;
|
namespace App\Listeners;
|
||||||
|
|
||||||
use Illuminate\Notifications\Events\NotificationSent;
|
use Illuminate\Notifications\Events\NotificationSent;
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class LogNotification
|
class LogNotification
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Laragear\WebAuthn\WebAuthnAuthentication;
|
use Laragear\WebAuthn\WebAuthnAuthentication;
|
||||||
use Laravel\Passport\HasApiTokens;
|
use Laravel\Passport\HasApiTokens;
|
||||||
@ -92,7 +91,7 @@ public function scopeAdmins($query)
|
|||||||
/**
|
/**
|
||||||
* Determine if the user is an administrator.
|
* Determine if the user is an administrator.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isAdministrator()
|
public function isAdministrator()
|
||||||
{
|
{
|
||||||
@ -102,7 +101,6 @@ public function isAdministrator()
|
|||||||
/**
|
/**
|
||||||
* Grant administrator permissions to the user.
|
* Grant administrator permissions to the user.
|
||||||
*
|
*
|
||||||
* @param bool $promote
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function promoteToAdministrator(bool $promote = true)
|
public function promoteToAdministrator(bool $promote = true)
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
class TestEmailSettingNotification extends Notification
|
class TestEmailSettingNotification extends Notification
|
||||||
{
|
{
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * The callback that should be used to create the reset password URL.
|
// * The callback that should be used to create the reset password URL.
|
||||||
// *
|
// *
|
||||||
|
@ -14,7 +14,7 @@ class UserObserver
|
|||||||
/**
|
/**
|
||||||
* Handle the User "created" event.
|
* Handle the User "created" event.
|
||||||
*/
|
*/
|
||||||
public function created(User $user): void
|
public function created(User $user) : void
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ public function created(User $user): void
|
|||||||
/**
|
/**
|
||||||
* Handle the User "updated" event.
|
* Handle the User "updated" event.
|
||||||
*/
|
*/
|
||||||
public function updated(User $user): void
|
public function updated(User $user) : void
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ public function updated(User $user): void
|
|||||||
/**
|
/**
|
||||||
* Handle the User "deleting" event.
|
* Handle the User "deleting" event.
|
||||||
*/
|
*/
|
||||||
public function deleting(User $user): bool
|
public function deleting(User $user) : bool
|
||||||
{
|
{
|
||||||
Log::info(sprintf('Deletion of User ID #%s requested by User ID #%s', $user->id, Auth::user()->id ?? 'unknown'));
|
Log::info(sprintf('Deletion of User ID #%s requested by User ID #%s', $user->id, Auth::user()->id ?? 'unknown'));
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ public function deleting(User $user): bool
|
|||||||
/**
|
/**
|
||||||
* Handle the User "deleted" event.
|
* Handle the User "deleted" event.
|
||||||
*/
|
*/
|
||||||
public function deleted(User $user): void
|
public function deleted(User $user) : void
|
||||||
{
|
{
|
||||||
// DB has cascade delete enabled to flush 2FA and Groups but,
|
// DB has cascade delete enabled to flush 2FA and Groups but,
|
||||||
// for an unknown reason, SQLite refuses to delete these related.
|
// for an unknown reason, SQLite refuses to delete these related.
|
||||||
@ -82,7 +82,7 @@ public function deleted(User $user): void
|
|||||||
/**
|
/**
|
||||||
* Handle the User "restored" event.
|
* Handle the User "restored" event.
|
||||||
*/
|
*/
|
||||||
public function restored(User $user): void
|
public function restored(User $user) : void
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ public function restored(User $user): void
|
|||||||
/**
|
/**
|
||||||
* Handle the User "force deleted" event.
|
* Handle the User "force deleted" event.
|
||||||
*/
|
*/
|
||||||
public function forceDeleted(User $user): void
|
public function forceDeleted(User $user) : void
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ class UserPolicy
|
|||||||
/**
|
/**
|
||||||
* Perform pre-authorization checks.
|
* Perform pre-authorization checks.
|
||||||
*/
|
*/
|
||||||
public function before(User $user, string $ability): bool|null
|
public function before(User $user, string $ability) : ?bool
|
||||||
{
|
{
|
||||||
if ($user->isAdministrator()) {
|
if ($user->isAdministrator()) {
|
||||||
return true;
|
return true;
|
||||||
@ -24,7 +24,7 @@ public function before(User $user, string $ability): bool|null
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can view any models.
|
* Determine whether the user can view any models.
|
||||||
*/
|
*/
|
||||||
public function viewAny(User $user): bool
|
public function viewAny(User $user) : bool
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ public function viewAny(User $user): bool
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can view the model.
|
* Determine whether the user can view the model.
|
||||||
*/
|
*/
|
||||||
public function view(User $user, User $model): bool
|
public function view(User $user, User $model) : bool
|
||||||
{
|
{
|
||||||
$can = $this->isHimself($user, $model);
|
$can = $this->isHimself($user, $model);
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public function view(User $user, User $model): bool
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can create models.
|
* Determine whether the user can create models.
|
||||||
*/
|
*/
|
||||||
public function create(?User $user): bool
|
public function create(?User $user) : bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ public function create(?User $user): bool
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can update the model.
|
* Determine whether the user can update the model.
|
||||||
*/
|
*/
|
||||||
public function update(User $user, User $model): bool
|
public function update(User $user, User $model) : bool
|
||||||
{
|
{
|
||||||
$can = $this->isHimself($user, $model);
|
$can = $this->isHimself($user, $model);
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ public function update(User $user, User $model): bool
|
|||||||
/**
|
/**
|
||||||
* Determine whether the user can delete the model.
|
* Determine whether the user can delete the model.
|
||||||
*/
|
*/
|
||||||
public function delete(User $user, User $model): bool
|
public function delete(User $user, User $model) : bool
|
||||||
{
|
{
|
||||||
$can = $this->isHimself($user, $model);
|
$can = $this->isHimself($user, $model);
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
use Illuminate\Support\Facades\Blade;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Laravel\Passport\Console\ClientCommand;
|
use Laravel\Passport\Console\ClientCommand;
|
||||||
|
@ -11,7 +11,7 @@ class ComplyWithEmailRestrictionPolicy implements ValidationRule
|
|||||||
/**
|
/**
|
||||||
* Run the validation rule.
|
* Run the validation rule.
|
||||||
*/
|
*/
|
||||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
public function validate(string $attribute, mixed $value, Closure $fail) : void
|
||||||
{
|
{
|
||||||
$list = Settings::get('restrictList');
|
$list = Settings::get('restrictList');
|
||||||
$regex = Settings::get('restrictRule');
|
$regex = Settings::get('restrictRule');
|
||||||
@ -31,8 +31,7 @@ public function validate(string $attribute, mixed $value, Closure $fail): void
|
|||||||
if (! $validatesFilter && ! $validatesRegex) {
|
if (! $validatesFilter && ! $validatesRegex) {
|
||||||
$fail('validation.custom.email.ComplyWithEmailRestrictionPolicy')->translate();
|
$fail('validation.custom.email.ComplyWithEmailRestrictionPolicy')->translate();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (! $validatesFilter || ! $validatesRegex) {
|
if (! $validatesFilter || ! $validatesRegex) {
|
||||||
$fail('validation.custom.email.ComplyWithEmailRestrictionPolicy')->translate();
|
$fail('validation.custom.email.ComplyWithEmailRestrictionPolicy')->translate();
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ class IsValideEmailList implements ValidationRule
|
|||||||
/**
|
/**
|
||||||
* Run the validation rule.
|
* Run the validation rule.
|
||||||
*/
|
*/
|
||||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
public function validate(string $attribute, mixed $value, Closure $fail) : void
|
||||||
{
|
{
|
||||||
$emails = explode('|', $value);
|
$emails = explode('|', $value);
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public function test_index_returns_all_users()
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function test_index_succeeds_and_returns_UserManagerResource(): void
|
public function test_index_succeeds_and_returns_UserManagerResource() : void
|
||||||
{
|
{
|
||||||
$path = '/api/v1/users';
|
$path = '/api/v1/users';
|
||||||
$resources = UserManagerResource::collection(User::all());
|
$resources = UserManagerResource::collection(User::all());
|
||||||
@ -121,7 +121,7 @@ public function test_show_returns_the_correct_user()
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function test_show_returns_UserManagerResource(): void
|
public function test_show_returns_UserManagerResource() : void
|
||||||
{
|
{
|
||||||
$path = '/api/v1/users/' . $this->user->id;
|
$path = '/api/v1/users/' . $this->user->id;
|
||||||
$resources = UserManagerResource::make($this->user);
|
$resources = UserManagerResource::make($this->user);
|
||||||
@ -247,7 +247,7 @@ public function test_store_creates_the_user_and_returns_success()
|
|||||||
'email' => self::EMAIL,
|
'email' => self::EMAIL,
|
||||||
'password' => self::PASSWORD,
|
'password' => self::PASSWORD,
|
||||||
'password_confirmation' => self::PASSWORD,
|
'password_confirmation' => self::PASSWORD,
|
||||||
'is_admin' => false
|
'is_admin' => false,
|
||||||
])
|
])
|
||||||
->assertCreated();
|
->assertCreated();
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ public function test_store_creates_the_user_and_returns_success()
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function test_store_returns_UserManagerResource_of_created_user(): void
|
public function test_store_returns_UserManagerResource_of_created_user() : void
|
||||||
{
|
{
|
||||||
$path = '/api/v1/users';
|
$path = '/api/v1/users';
|
||||||
$userDefinition = (new UserFactory)->definition();
|
$userDefinition = (new UserFactory)->definition();
|
||||||
@ -280,7 +280,7 @@ public function test_store_returns_UserManagerResource_of_created_user(): void
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function test_store_returns_UserManagerResource_of_created_admin(): void
|
public function test_store_returns_UserManagerResource_of_created_admin() : void
|
||||||
{
|
{
|
||||||
$path = '/api/v1/users';
|
$path = '/api/v1/users';
|
||||||
$userDefinition = (new UserFactory)->definition();
|
$userDefinition = (new UserFactory)->definition();
|
||||||
@ -452,11 +452,11 @@ public function test_destroy_the_only_admin_returns_forbidden()
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function test_promote_changes_admin_status(): void
|
public function test_promote_changes_admin_status() : void
|
||||||
{
|
{
|
||||||
$this->actingAs($this->admin, 'api-guard')
|
$this->actingAs($this->admin, 'api-guard')
|
||||||
->json('PATCH', '/api/v1/users/' . $this->user->id . '/promote', [
|
->json('PATCH', '/api/v1/users/' . $this->user->id . '/promote', [
|
||||||
'is_admin' => true
|
'is_admin' => true,
|
||||||
])
|
])
|
||||||
->assertOk();
|
->assertOk();
|
||||||
|
|
||||||
@ -468,14 +468,14 @@ public function test_promote_changes_admin_status(): void
|
|||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function test_promote_returns_UserManagerResource(): void
|
public function test_promote_returns_UserManagerResource() : void
|
||||||
{
|
{
|
||||||
$path = '/api/v1/users/' . $this->user->id . '/promote';
|
$path = '/api/v1/users/' . $this->user->id . '/promote';
|
||||||
$request = Request::create($path, 'PUT');
|
$request = Request::create($path, 'PUT');
|
||||||
|
|
||||||
$response = $this->actingAs($this->admin, 'api-guard')
|
$response = $this->actingAs($this->admin, 'api-guard')
|
||||||
->json('PATCH', $path, [
|
->json('PATCH', $path, [
|
||||||
'is_admin' => true
|
'is_admin' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->user->refresh();
|
$this->user->refresh();
|
||||||
@ -483,6 +483,4 @@ public function test_promote_returns_UserManagerResource(): void
|
|||||||
|
|
||||||
$response->assertExactJson($resources->response($request)->getData(true));
|
$response->assertExactJson($resources->response($request)->getData(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,9 @@ class SystemControllerTest extends FeatureTestCase
|
|||||||
/**
|
/**
|
||||||
* @var \App\Models\User|\Illuminate\Contracts\Auth\Authenticatable
|
* @var \App\Models\User|\Illuminate\Contracts\Auth\Authenticatable
|
||||||
*/
|
*/
|
||||||
protected $user, $admin;
|
protected $user;
|
||||||
|
|
||||||
|
protected $admin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
@ -77,7 +79,7 @@ public function test_infos_returns_only_base_collection()
|
|||||||
'Auth guard',
|
'Auth guard',
|
||||||
'webauthn user verification',
|
'webauthn user verification',
|
||||||
'Trusted proxies',
|
'Trusted proxies',
|
||||||
'lastRadarScan'
|
'lastRadarScan',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public function test_model_configuration()
|
|||||||
[
|
[
|
||||||
'id' => 'int',
|
'id' => 'int',
|
||||||
'twofaccounts_count' => 'integer',
|
'twofaccounts_count' => 'integer',
|
||||||
'user_id' => 'integer'
|
'user_id' => 'integer',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'deleting' => GroupDeleting::class,
|
'deleting' => GroupDeleting::class,
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
use App\Listeners\RegisterOpenId;
|
use App\Listeners\RegisterOpenId;
|
||||||
use App\Providers\Socialite\OpenId;
|
use App\Providers\Socialite\OpenId;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Laravel\Socialite\SocialiteManager;
|
|
||||||
use Laravel\Socialite\Contracts\Factory as SocialiteFactory;
|
use Laravel\Socialite\Contracts\Factory as SocialiteFactory;
|
||||||
|
use Laravel\Socialite\SocialiteManager;
|
||||||
use PHPUnit\Framework\Attributes\CoversClass;
|
use PHPUnit\Framework\Attributes\CoversClass;
|
||||||
use SocialiteProviders\Manager\SocialiteWasCalled;
|
use SocialiteProviders\Manager\SocialiteWasCalled;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
@ -35,7 +35,7 @@ public function test_model_configuration()
|
|||||||
[],
|
[],
|
||||||
[
|
[
|
||||||
'id' => 'int',
|
'id' => 'int',
|
||||||
'user_id' => 'integer'
|
'user_id' => 'integer',
|
||||||
],
|
],
|
||||||
['deleted' => TwoFAccountDeleted::class],
|
['deleted' => TwoFAccountDeleted::class],
|
||||||
['created_at', 'updated_at'],
|
['created_at', 'updated_at'],
|
||||||
|
Loading…
Reference in New Issue
Block a user