O Escalated utiliza dois gates de autorizacao para controlar o acesso as visualizacoes de agente e administrador. Defina-os na sua aplicacao para controlar quem pode gerenciar tickets.
Nota: O Escalated compartilha automaticamente page.props.escalated em todas as respostas Inertia, contendo o prefixo da rota e o status de agente/administrador do usuario atual.
Defina dois gates em App\Providers\AppServiceProvider::boot() para Laravel 12+, ou em App\Providers\AuthServiceProvider::boot() para Laravel 11 e anteriores:
use Illuminate\Support\Facades\Gate;
// Quem pode acessar o painel do agente e gerenciar tickets
Gate::define('escalated-agent', fn ($user) =>
$user->is_agent
);
// Quem pode acessar as configuracoes de administracao (departamentos, SLAs, regras, etc.)
Gate::define('escalated-admin', fn ($user) =>
$user->is_admin
);
Os nomes dos gates sao configuraveis em config/escalated.php nas chaves authorization.admin_gate e authorization.agent_gate.
Configure lambdas no inicializador:
Escalated.configure do |config|
config.admin_check = ->(user) { user.admin? }
config.agent_check = ->(user) { user.agent? || user.admin? }
end
O WordPress utiliza funcoes e capacidades nativas. O plugin registra duas funcoes personalizadas:
Funcao
Descricao
escalated_agent
Pode visualizar e gerenciar tickets
escalated_admin
Acesso total a configuracoes, departamentos e politicas de 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-agent and escalated-admin gates 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-agent and escalated-admin gates from your backend still apply to all API requests. The mobile app simply doesn't expose agent or admin views.