Unlink Permission
Remove a permission relationship between two objects.
Usage
Use the ThingsTelemetry\Traccar\Facades\Permission::unlink() method to remove a permission relationship between two objects.
php
use ThingsTelemetry\Traccar\Facades\Permission;
use ThingsTelemetry\Traccar\Dto\PermissionData;
$permission = new PermissionData(
userId: 5,
deviceId: 10
);
$result = Permission::unlink($permission);
if ($result->status->value === 'success') {
echo "Permission unlinked successfully";
}Examples
Remove User's Access to Device
php
use ThingsTelemetry\Traccar\Facades\Permission;
use ThingsTelemetry\Traccar\Dto\PermissionData;
$permission = new PermissionData(userId: 5, deviceId: 10);
Permission::unlink($permission);Remove User's Access to Group
php
$permission = new PermissionData(userId: 5, groupId: 2);
Permission::unlink($permission);Remove Device's Geofence Association
php
$permission = new PermissionData(deviceId: 10, geofenceId: 3);
Permission::unlink($permission);Remove User Management Permission
php
$permission = new PermissionData(userId: 5, managedUserId: 8);
Permission::unlink($permission);Important Notes
- Exactly 2 parameters must be provided in the
PermissionDataobject - The parameters must match the exact relationship you want to remove
- Standard users can only remove their own permissions
- If the permission doesn't exist, the operation may still return success
Related Operations
- Link Permission - Create a permission link
- Link Permissions (Bulk) - Link multiple permissions at once
- Unlink Permissions (Bulk) - Remove multiple permissions at once