Skip to content

A free open source IT asset/license management system

Gate to superuser

snipe39df28921dda
diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php
index 915cb54c49..456e77606a 100644
--- a/app/Http/Controllers/Api/UsersController.php
+++ b/app/Http/Controllers/Api/UsersController.php
@@ -1043,7 +1043,13 @@ class UsersController extends Controller
*/
public function syncLdapUsers(Request $request)
{
- $this->authorize('update', User::class);
+ // Superuser-only: a bulk LDAP sync surfaces users from across
+ // the entire directory (all companies, all OUs), so anyone with
+ // "users.edit" but no full-directory access shouldn't be able
+ // to run it or read the summary that lists them.
+ if (! auth()->user()?->isSuperUser()) {
+ abort(403);
+ }
// Call Artisan LDAP import command.
Artisan::call('snipeit:ldap-sync', ['--location_id' => $request->input('location_id'), '--json_summary' => true]);