]> BookStack Code Mirror - bookstack/blobdiff - app/Users/Controllers/UserApiController.php
Permissions: Updated use of helpers to use enums
[bookstack] / app / Users / Controllers / UserApiController.php
index 351893b032b84d313691012f6b666379fef69cdd..28c4a387619de7d5ef2e118f21f6828d8e303843 100644 (file)
@@ -4,9 +4,9 @@ namespace BookStack\Users\Controllers;
 
 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;
@@ -26,7 +26,7 @@ class UserApiController extends ApiController
 
         // 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);
@@ -125,7 +125,7 @@ class UserApiController extends ApiController
     {
         $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(\BookStack\Permissions\Permission::UsersManage));
         $this->singleFormatter($user);
 
         return response()->json($user);