/usr/share/davical/inc/PublicSession.php is in davical 1.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | <?php
/**
* A Class for faking sessions which are anonymous access to a resource
*
* @package davical
* @subpackage PublicSession
* @author Andrew McMillan <andrew@morphoss.com>
* @copyright Morphoss Ltd
* @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later
*/
/**
* A Class for handling a public (anonymous) session
*
* @package davical
*/
class PublicSession {
/**#@+
* @access private
*/
/**
* User ID number
* @var user_no int
*/
var $user_no;
/**
* Principal ID
* @var principal_id int
*/
var $principal_id;
/**
* User e-mail
* @var email string
*/
var $email;
/**
* User full name
* @var fullname string
*/
var $fullname;
/**
* Group rights
* @var groups array
*/
var $groups;
/**#@-*/
/**
* The constructor, which just calls the actual type configured
*/
function PublicSession() {
global $c;
$principal = new Principal('username','unauthenticated');
// Assign each field in the selected record to the object
foreach( $principal AS $k => $v ) {
$this->{$k} = $v;
}
$this->username = $principal->username();
$this->user_no = $principal->user_no();
$this->principal_id = $principal->principal_id();
$this->email = $principal->email();
$this->dav_name = $principal->dav_name();
$this->principal = $principal;
if ( function_exists("awl_set_locale") && isset($this->locale) && $this->locale != "" ) {
awl_set_locale($this->locale);
}
$this->groups = ( isset($c->public_groups) ? $c->public_groups : array() );
$this->roles = array( 'Public' => true );
$this->logged_in = false;
}
/**
* Checks whether a user is allowed to do something.
*
* The check is performed to see if the user has that role.
*
* @param string $whatever The role we want to know if the user has.
* @return boolean Whether or not the user has the specified role.
*/
function AllowedTo ( $whatever ) {
dbg_error_log('session', 'Checking whether "Public" is allowed to "%s"', $whatever);
return ( isset($this->roles[$whatever]) && $this->roles[$whatever] );
}
}
|