DAViCal
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;
62 function __construct() {
63 global $c;
64
65 $principal = new Principal('username','unauthenticated');
66
67 // Assign each field in the selected record to the object
68 foreach( $principal AS $k => $v ) {
69 $this->{$k} = $v;
70 }
71
72 $this->username = $principal->username();
73 $this->user_no = $principal->user_no();
74 $this->principal_id = $principal->principal_id();
75 $this->email = $principal->email();
76 $this->fullname = $principal->fullname;
77 $this->dav_name = $principal->dav_name();
78 $this->principal = $principal;
79
80 if ( function_exists("awl_set_locale") && isset($this->locale) && $this->locale != "" ) {
81 awl_set_locale($this->locale);
82 }
83
84 $this->groups = ( isset($c->public_groups) ? $c->public_groups : array() );
85 $this->roles = array( 'Public' => true );
86 $this->logged_in = false;
87 }
88
89
98 function AllowedTo ( $whatever ) {
99 dbg_error_log('session', 'Checking whether "Public" is allowed to "%s"', $whatever);
100 return ( isset($this->roles[$whatever]) && $this->roles[$whatever] );
101 }
102
103}
104
AllowedTo( $whatever)