- ⌂ User
- Methods
User::check_authorized_object()
Check if a user is authorized with a specified Privilege for a specified cObject.
Prototype
boolean check_authorized_object(cObject $object, string $ns = NULL, string $id = NULL, boolean $force = FALSE)
Parameters
- object - The object to check authorizations against.
- ns - The privilege namespace to check for (default io_comand_auth).
- id - The privilege identifier to check for (default CREATE).
- force - Whether to force the cached authorizations to be reloaded.
Return
TRUE if this user is authorized for the specified Privilege and cObject, FALSE otherwise.
Example
$app = $repo->get("FROM WebCOMANDApp WHERE Identifier='api'");
$users = $repo->get("FROM User WHERE Email!=''");
foreach($users as $user) {
if(!$user->check_authorized_object($app, 'com_webcomand', 'RUN')) {
echo($user->get_full_name() . " can run API App.\n" );
}
}