This is a multi-layered permissions issue that’s common with automated shift handover in Apriso 2021. Let me break down all the permission requirements:
1. API User Permissions (Role-Based)
The ResourceManager role is necessary but not sufficient. You need:
- ResourceManager role (you have this)
- OperatorAssignment permission (separate from ResourceManager)
- ShiftManagement permission (for accessing shift data)
Verify by running:
SELECT r.ROLE_NAME, p.PERMISSION_NAME
FROM USER_ROLES ur
JOIN ROLES r ON ur.ROLE_ID = r.ID
JOIN ROLE_PERMISSIONS rp ON r.ID = rp.ROLE_ID
JOIN PERMISSIONS p ON rp.PERMISSION_ID = p.ID
WHERE ur.USER_ID = 'your_api_user'
2. Role-Resource Mapping (Object-Level)
Even with correct roles, you need explicit resource access. The API gateway policies in 2021 enforce object-level security that the UI bypasses for interactive users.
Add resource-level grants:
POST /api/v1/security/resource-grants
{
"userId": "api_service_account",
"resourceType": "MACHINE",
"resourceId": "M-1001",
"permissions": ["READ", "ASSIGN_OPERATOR"]
}
3. API Gateway Policies
In Apriso 2021, there’s a known configuration issue where the API gateway applies stricter policies than intended. Check your apigateway.properties:
apriso.api.security.enforceResourceACL=true
apriso.api.security.allowRoleInheritance=true
If allowRoleInheritance=false, the API won’t recognize your ResourceManager role’s implicit permissions. Set it to true and restart the API gateway service.
4. Shift Handover Automation Specifics
For automated assignments, you also need:
- The operator must be in AVAILABLE status
- The machine must be in IDLE or READY state
- The shift must be currently active (not future or past)
- The operator must have active qualifications for that machine type
Add these checks before your assignment call:
// Validate operator status
const operator = await api.get(`/operators/${operatorId}`);
if (operator.status !== 'AVAILABLE') {
throw new Error('Operator not available');
}
// Validate machine state
const machine = await api.get(`/machines/${machineId}`);
if (!['IDLE', 'READY'].includes(machine.state)) {
throw new Error('Machine not ready for assignment');
}
// Then proceed with assignment
5. Service Account Configuration
Create a dedicated service account with the correct permission bundle:
- Go to Admin Console → Security → Service Accounts
- Create new account: `shift_automation_api
- Assign permission bundle: “Resource Assignment API”
- Generate API key with scopes: `resource:read resource:assign shift:read
Testing the Fix
- Apply the role-resource mapping grants
- Update API gateway properties
- Restart API gateway service
- Test with explicit permission check:
GET /api/v1/users/current/permissions?resource=M-1001
Should return: `[“READ”, “ASSIGN_OPERATOR”]
5. Retry your assignment with updated credentials
This comprehensive approach addresses all permission layers. The 403 error typically means you’re missing the object-level grant (step 2) even though you have the role-level permission (step 1).