Add subuser permission evaluation system and extend subuser-related route handling

- Introduce `hasPermission` method in `subusers_o` for permission checks tied to customer context.
- Update `/subusers/me` route to return subuser grants with normalized permissions and metadata.
- Add `get_subuser_customer_number_target` in `authentication` to resolve customer context from request headers.
- Refactor route-level permission checks to handle subuser grants dynamically.
- Introduce CLI test scripts for subuser grants and permission node mappings.
- Add test coverage for subuser grants and permission nodes in new test classes.
This commit is contained in:
Jeppe Bundgaard
2026-02-12 15:29:43 +01:00
parent 6375bc7f12
commit 497ef1496b
9 changed files with 297 additions and 113 deletions
@@ -181,4 +181,16 @@ class authentication implements authentication_i
}
return true;
}
public function get_subuser_customer_number_target(): int|false
{
/**
* Decode the headers
*/
$headers = getallheaders();
if (!isset($headers['X-Customer-Number'])) {
return false;
}
return (int)$headers['X-Customer-Number'];
}
}