DAViCal
Loading...
Searching...
No Matches
PublicSession.php
1<?php
26 public $username;
27
32 public $user_no;
33
38 public $principal_id;
39
44 public $email;
45
50 public $fullname;
51
56 public $groups;
57
58 /* These fields were being added dynmically. Set to private mostly, I had to
59 * set these as public for tests to pass: principal
60 */
61 private $dav_name;
62 public $principal;
63 private $roles;
64 private $logged_in;
70 function __construct() {
71 global $c;
72
73 $principal = new Principal('username','unauthenticated');
74
75 $this->username = $principal->username();
76 $this->user_no = $principal->user_no();
77 $this->principal_id = $principal->principal_id();
78 $this->email = $principal->email();
79 $this->fullname = $principal->fullname;
80 $this->dav_name = $principal->dav_name();
81 $this->principal = $principal;
82
83 if ( function_exists("awl_set_locale") && isset($this->locale) && $this->locale != "" ) {
84 awl_set_locale($this->locale);
85 }
86
87 $this->groups = ( isset($c->public_groups) ? $c->public_groups : array() );
88 $this->roles = array( 'Public' => true );
89 $this->logged_in = false;
90 }
91
92
101 function AllowedTo ( $whatever ) {
102 dbg_error_log('session', 'Checking whether "Public" is allowed to "%s"', $whatever);
103 return ( isset($this->roles[$whatever]) && $this->roles[$whatever] );
104 }
105
106}
107
AllowedTo( $whatever)