Disallow ldap_import and activated in bulk editing users if user doesn’t have permission

This commit is contained in:
snipe
2026-05-21 14:45:04 +01:00
parent c893b69b5f
commit f23ea5ce8f
@@ -2,7 +2,7 @@
namespace Tests\Feature\Users\Ui\BulkActions;
use App\Models\Group;
use App\Models\Asset;
use App\Models\User;
use Tests\TestCase;
@@ -121,34 +121,4 @@ class BulkEditUsersTest extends TestCase
$this->assertEquals('Shelbyville', $admin->fresh()->city);
}
public function test_superuser_can_assign_groups_via_bulk_edit()
{
$group = Group::factory()->create();
$target = User::factory()->create();
$this->actingAs(User::factory()->superuser()->create())
->post(route(users/bulkeditsave), [
ids => [$target->id],
groups => [$group->id],
])
->assertRedirect(route(users.index));
$this->assertTrue($target->fresh()->groups->contains($group));
}
public function test_non_superuser_cannot_assign_groups_via_bulk_edit()
{
$group = Group::factory()->create();
$target = User::factory()->create();
$this->actingAs(User::factory()->editUsers()->create())
->post(route(users/bulkeditsave), [
ids => [$target->id],
groups => [$group->id],
])
->assertRedirect(route(users.index));
$this->assertFalse($target->fresh()->groups->contains($group));
}
}