To check if a user is allowed to access a resource, use the session_allowed() function, which takes the following parameters:
- $resource - The name of the resource.
- $access - The level of access. Either 'r', 'w', or 'rw' for Read, Write, or Read and Write.
- $type - The type of resource. This can be one of 'resource', 'access', 'status', and 'team'.
An example use in PHP is:
<?php
if (session_allowed ('sitellite_page', 'r', 'resource')) {
// can read web pages
} else {
// can't read web pages
}
?>
Created on April 23, 2005 1:35 AM by lux
Linked from: Authentication