Roles user add fix (#15257)

* Fix user add command doesn't allow roles

* update baseline
This commit is contained in:
Tony Murray 2023-08-28 10:27:56 -05:00 committed by GitHub
parent 744ff7543e
commit c737788727
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -27,10 +27,10 @@ namespace App\Console\Commands;
use App\Console\LnmsCommand;
use App\Models\User;
use Bouncer;
use Illuminate\Validation\Rule;
use LibreNMS\Authentication\LegacyAuth;
use LibreNMS\Config;
use Silber\Bouncer\Database\Role;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
@ -68,12 +68,12 @@ class AddUserCommand extends LnmsCommand
$this->warn(__('commands.user:add.wrong-auth'));
}
$roles = Role::pluck('name');
$roles = Bouncer::role()->pluck('name');
$this->validate([
'username' => ['required', Rule::unique('users', 'username')->where('auth_type', 'mysql')],
'email' => 'nullable|email',
'role' => Rule::in($roles->keys()),
'role.*' => Rule::in($roles),
]);
// set get password

View File

@ -170,6 +170,11 @@ parameters:
count: 1
path: LibreNMS/Util/Snmpsim.php
-
message: "#^Static method Silber\\\\Bouncer\\\\BouncerFacade\\:\\:role\\(\\) invoked with 0 parameters, 1 required\\.$#"
count: 1
path: app/Console/Commands/AddUserCommand.php
-
message: "#^Property App\\\\Console\\\\Commands\\\\InternalHttpRequest\\:\\:\\$app is never read, only written\\.$#"
count: 1