Fix: Общие группы могут добавлять любых пользователей

 Проверка organization_id только для групп организации
 Общие группы добавляют любых пользователей
 Разные placeholder для общих/организационных групп

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
mirivlad 2026-03-31 16:44:31 +08:00
parent 98b0e7f9a9
commit 500ff03309
2 changed files with 13 additions and 4 deletions

View File

@ -129,7 +129,8 @@ class GroupUserController extends Controller
$user = User::find($userId); $user = User::find($userId);
if (!$user) continue; if (!$user) continue;
// Проверка: если группа организации - только пользователи этой организации // Проверка: ТОЛЬКО если группа организации - только пользователи этой организации
// Общие группы могут добавлять любых пользователей
if ($group->organization_id && $user->organization_id !== $group->organization_id) { if ($group->organization_id && $user->organization_id !== $group->organization_id) {
continue; continue;
} }

View File

@ -85,14 +85,22 @@
<button type="button" class="btn-close" data-bs-dismiss="modal"></button> <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
@if($group->organization_id)
<x-tags-input <x-tags-input
name="user_ids" name="user_ids"
url="{{ route('api.users.search') }}?{{ $group->organization_id ? 'organization_id=' . $group->organization_id : '' }}" url="{{ route('api.users.search', ['organization_id' => $group->organization_id]) }}"
placeholder="{{ $group->organization_id ? 'Начните вводить имя (только ваша организация)...' : 'Начните вводить имя...' }}" placeholder="Начните вводить имя (только ваша организация)..."
badge_color="success" badge_color="success"
/> />
@if($group->organization_id)
<small class="text-muted">Показываются только пользователи вашей организации</small> <small class="text-muted">Показываются только пользователи вашей организации</small>
@else
<x-tags-input
name="user_ids"
url="{{ route('api.users.search') }}"
placeholder="Начните вводить имя (любые пользователи)..."
badge_color="success"
/>
<small class="text-muted">Общая группа можно добавлять любых пользователей</small>
@endif @endif
</div> </div>
<div class="modal-footer"> <div class="modal-footer">