Source for file auth.php
Documentation is available at auth.php
* User Authentication and Authorisation (Login and Permissions object)
* @author Stuart Prescott
* @copyright Copyright Stuart Prescott
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
/** Load ancillary functions */
require_once 'inc/typeinfo.php';
/** inherit from basic auth module */
require_once 'inc/bb/basicauth.php';
/** sql manipulation routines */
require_once 'inc/formslib/sql.php';
/** type checking and data manipulation */
require_once 'inc/typeinfo.php';
require_once 'inc/permissions.php';
require_once 'inc/logging.php';
/** system configuration */
require_once 'inc/bb/configreader.php';
* User *authorisation* and *authentication* object
* @todo //TODO: update permissions system
* @todo //TODO: documentation
var $euid; //permit user masquerading like su. Effective UID
* @param array $data array containing keys 'username' and 'pass'
* @param boolean $recheck (optional) ignore session data and check anyway
* @param string $table (optional) db table from which login data should be taken
function BumblebeeAuth($data, $recheck =
false, $table=
'users') {
// set up Authorisation parts
if (isset
($_POST['changeuser']) || isset
($_GET['changeuser'])) {
if ((isset
($_POST['anonymous']) || isset
($_GET['anonymous']))
&&
$conf->value('display', 'AnonymousAllowed', false)) {
$data['username'] =
$conf->value('display', 'AnonymousUsername');
$data['pass'] =
$conf->value('display', 'AnonymousPassword');
* Permit user masquerading -- the admin user can become another user for a period
* of time to make a bookings etc
trigger_error("using deprecated isInstrumentAdmin", E_USER_NOTICE);
print
"file= ".
$l[0]['file'] .
", line=".
$l[0]['line'].
"\n<br />";
// look for permissions across all instruments
.
' FROM '.
$TABLEPREFIX.
'permissions'
.
' WHERE userid=' .
qw($this->uid);
if (isset
($row['permissions']) &&
$conf->value('auth', 'permissionsModel', false)) {
$permission =
$row['permissions'];
$total =
((int)
$total) |
((int)
$permission);
array('userid', 'instrid'),
array($this->uid, $instrument)
if (isset
($row['permissions']) &&
$conf->value('auth', 'permissionsModel', false)) {
$permission =
$row['permissions'];
//save the permissions to speed this up later
* make up the permissions for the instrument
* @param array $row from the database
* @returns integer permissions
logmsg(2, "Making up some permissions for instrument. Upgrade database format to get rid of this message.");
if (isset
($row['isadmin']) &&
$row['isadmin']) {
return (isset
($this->euid) ?
$this->euid :
$this->uid);
return (isset
($this->euid) &&
$this->euid !=
$this->uid);
* start masquerading as another user
// masquerade not permitted
echo
"Couldn't assume masq";
* stop masquerading as another user
function permitted($operation, $instrument=
NULL) {
//print "Requested: $operation and have permissions $this->system_permissions<br/>";
// NOTE: Must cast to int before using PHP's bitwise operators else you will get stupid results
// due to the loose typing mechanism switching the variables to float or string on you.
if ($instrument ===
NULL) {
// looking for system permissions
foreach ($instrument as $i) {
if (! $this->permitted($operation, $i)) return false;
#echo "op = ". $operation;
#echo "instr = " .(int) $this->instrument_permissions($instrument);
#echo "ok=". ((int) $this->instrument_permissions($instrument) & (int) $operation);
return (((int)
$operation)
if (isset
($this->user_row['permissions']) &&
$conf->value('auth', 'permissionsModel', false)) {
logmsg(2, "Making up some permissions for user. Upgrade database format to get rid of this message.");
Documentation generated on Tue, 06 Mar 2007 10:00:36 +0000 by phpDocumentor 1.3.0