Fix issue where users with edit permission cannot invoke LDAP sync (#9058)

* Fix issue where users with edit permission cannot invoke LDAP sync

* Make User::class consistent with usage elsewhere in the same directory
This commit is contained in:
Brady Wetherington 2021-01-27 15:36:43 -08:00 committed by GitHub
parent 6772835efc
commit 70e6a6ced6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use App\Services\LdapAd;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use App\Models\User; // Note that this is awful close to 'Users' the namespace above; be careful
class LDAPImportController extends Controller
{
@ -65,6 +66,7 @@ class LDAPImportController extends Controller
*/
public function store(Request $request)
{
$this->authorize('update', User::class);
// Call Artisan LDAP import command.
$location_id = $request->input('location_id');
Artisan::call('snipeit:ldap-sync', ['--location_id' => $location_id, '--json_summary' => true]);