fix: Flow Tester 인증 및 UI 오류 수정

- FlowTesterController: users() 메서드 피벗 테이블 쿼리로 변경
- FlowExecutor: 세션 토큰 우선순위 추가 (모달 토큰 사용)
- index.blade.php: tenant_id 표시 및 토큰 프리뷰 UI 수정
This commit is contained in:
2025-12-18 20:24:18 +09:00
parent 42c056ee5b
commit 84e0a09a29
3 changed files with 35 additions and 10 deletions

View File

@@ -346,10 +346,25 @@ public function runDetail(int $runId): View
*/
public function users()
{
$tenantId = auth()->user()->tenant_id;
// 현재 선택된 테넌트 ID (세션 기반)
$tenantId = session('selected_tenant_id');
$users = \App\Models\User::where('tenant_id', $tenantId)
->select(['id', 'name', 'email', 'tenant_id'])
if (! $tenantId) {
// 세션에 없으면 기본 테넌트 사용
$currentTenant = auth()->user()->currentTenant();
$tenantId = $currentTenant?->id;
}
if (! $tenantId) {
return response()->json([]);
}
// user_tenants 피벗 테이블을 통해 해당 테넌트의 사용자 조회
$users = \App\Models\User::whereHas('tenants', function ($query) use ($tenantId) {
$query->where('tenants.id', $tenantId)
->where('user_tenants.is_active', true);
})
->select(['id', 'name', 'email'])
->orderBy('name')
->limit(100)
->get();
@@ -391,7 +406,6 @@ public function selectUser(Request $request)
'id' => $user->id,
'name' => $user->name,
'email' => $user->email,
'tenant_id' => $user->tenant_id,
],
'token_preview' => substr($token, 0, 20).'...',
]);
@@ -447,7 +461,6 @@ public function tokenStatus()
'id' => $user->id,
'name' => $user->name,
'email' => $user->email,
'tenant_id' => $user->tenant_id,
] : null,
]);
}