구성 / 권한 부여
인가
Escalated는 에이전트 및 관리자 뷰에 대한 접근을 제어하기 위해 두 개의 인가 게이트를 사용합니다. 애플리케이션에서 이를 정의하여 티켓을 관리할 수 있는 사용자를 제어하세요.
참고: Escalated는 모든 Inertia 응답에
page.props.escalated를 자동으로 공유합니다. 여기에는 라우트 접두사와 현재 사용자의 에이전트/관리자 상태가 포함됩니다.
Laravel 12+??? App\Providers\AppServiceProvider::boot()?, Laravel 11 ????? App\Providers\AuthServiceProvider::boot()? ? ?? ???? ?????:
use Illuminate\Support\Facades\Gate;
// ???? ????? ???? ??? ??? ? ?? ???
Gate::define('escalated-agent', fn ($user) =>
$user->is_agent
);
// ??? ??(??, SLA, ?? ?)? ??? ? ?? ???
Gate::define('escalated-admin', fn ($user) =>
$user->is_admin
);
게이트 이름은 config/escalated.php의 authorization.admin_gate와 authorization.agent_gate에서 설정할 수 있습니다.
이니셜라이저에서 람다를 설정합니다:
Escalated.configure do |config|
config.admin_check = ->(user) { user.admin? }
config.agent_check = ->(user) { user.agent? || user.admin? }
end
설정에서 callable을 정의합니다:
ESCALATED = {
"ADMIN_CHECK": lambda user: user.is_staff,
"AGENT_CHECK": lambda user: hasattr(user, "is_agent") and user.is_agent,
}
설정에서 인가 콜백을 구성합니다:
authorization: {
isAgent: async (user) => {
return user.role === 'agent' || user.role === 'admin'
},
isAdmin: async (user) => {
return user.role === 'admin'
},
}
두 개의 Laravel 게이트를 정의하고 Filament 플러그인에서 참조합니다:
Gate::define('escalated-agent', fn ($user) => $user->is_agent);
Gate::define('escalated-admin', fn ($user) => $user->is_admin);
EscalatedFilamentPlugin::make()
->agentGate('escalated-agent')
->adminGate('escalated-admin')
WordPress는 내장된 역할과 기능을 사용합니다. 플러그인은 두 개의 커스텀 역할을 등록합니다:
| 역할 | 설명 |
|---|---|
escalated_agent |
티켓을 조회하고 관리할 수 있음 |
escalated_admin |
설정, 부서, SLA 정책에 대한 전체 접근 |
Authorization is handled entirely server-side. The Flutter package sends a Bearer token with each request, and your backend API controls what the authenticated user can access.
There are no client-side gates to define — the mobile app is a customer-facing UI, so agent and admin authorization checks only apply on the web.
Checking Auth State
Use the authProvider to check whether the current user is authenticated:
final authState = ref.watch(authProvider);
if (authState.isAuthenticated) {
// User is logged in, show ticket list
} else {
// Show login screen
}
Note: The
escalated-agentandescalated-admingates from your backend still apply to all API requests. The mobile app simply doesn't expose agent or admin views.
Authorization is handled entirely server-side. The React Native package sends a Bearer token with each request, and your backend API controls what the authenticated user can access.
There are no client-side gates to define — the mobile app is a customer-facing UI, so agent and admin authorization checks only apply on the web.
Checking Auth State
Use the useAuth hook to access the current user and authentication status:
import { useAuth } from '@escalated-dev/escalated-react-native';
function ProfileScreen() {
const { user, isAuthenticated } = useAuth();
if (!isAuthenticated) {
return <LoginScreen />;
}
return <Text>Welcome, {user.name}</Text>;
}
Note: The
escalated-agentandescalated-admingates from your backend still apply to all API requests. The mobile app simply doesn't expose agent or admin views.