use BookStack\Exceptions\UserUpdateException;
use BookStack\Http\ApiController;
+use BookStack\Permissions\Permission;
use BookStack\Users\Models\User;
use BookStack\Users\UserRepo;
-use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Validation\Rules\Password;
// Checks for all endpoints in this controller
$this->middleware(function ($request, $next) {
- $this->checkPermission('users-manage');
+ $this->checkPermission(Permission::UsersManage);
$this->preventAccessInDemoMode();
return $next($request);
return $this->apiListingResponse($users, [
'id', 'name', 'slug', 'email', 'external_auth_id',
'created_at', 'updated_at', 'last_activity_at',
- ], [Closure::fromCallable([$this, 'listFormatter'])]);
+ ], [$this->listFormatter(...)]);
}
/**
{
$data = $this->validate($request, $this->rules($id)['update']);
$user = $this->userRepo->getById($id);
- $this->userRepo->update($user, $data, userCan('users-manage'));
+ $this->userRepo->update($user, $data, userCan(Permission::UsersManage));
$this->singleFormatter($user);
return response()->json($user);