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:
@@ -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'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user