Escalated gebruikt twee autorisatiegates om de toegang tot agent- en beheerweergaven te regelen. Definieer deze in je applicatie om te bepalen wie tickets kan beheren.
Let op: Escalated deelt automatisch page.props.escalated met alle Inertia-responses, met daarin het routevoorvoegsel en de agent-/beheerderstatus van de huidige gebruiker.
Definieer twee gates in App\Providers\AppServiceProvider::boot() voor Laravel 12+, of in App\Providers\AuthServiceProvider::boot() voor Laravel 11 en ouder:
use Illuminate\Support\Facades\Gate;
// Wie toegang heeft tot het agentdashboard en tickets kan beheren
Gate::define('escalated-agent', fn ($user) =>
$user->is_agent
);
// Wie toegang heeft tot beheerinstellingen (afdelingen, SLA's, regels, enz.)
Gate::define('escalated-admin', fn ($user) =>
$user->is_admin
);
Gatenamen zijn configureerbaar via config/escalated.php onder authorization.admin_gate en authorization.agent_gate.
Configureer lambda's in de initializer:
Escalated.configure do |config|
config.admin_check = ->(user) { user.admin? }
config.agent_check = ->(user) { user.agent? || user.admin? }
end
WordPress gebruikt ingebouwde rollen en machtigingen. De plugin registreert twee aangepaste rollen:
Rol
Beschrijving
escalated_agent
Kan tickets bekijken en beheren
escalated_admin
Volledige toegang tot instellingen, afdelingen en SLA-beleid
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.