ILIAS  release_7 Revision v7.30-3-g800a261c036
ilCalendarRemoteAccessHandler Class Reference

@classDescription Handles requests from external calendar applications More...

+ Collaboration diagram for ilCalendarRemoteAccessHandler:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getTokenHandler ()
 
 parseRequest ()
 Fetch client id, the chosen calendar... More...
 
 handleRequest ()
 Handle Request. More...
 

Protected Member Functions

 initTokenHandler ()
 
 initLimitEnabled ()
 
 initIlias ()
 
 initUser ()
 Init user. More...
 

Protected Attributes

const LIMITED_QUERY_PARAM = 'limited'
 
 $limit_enabled
 

Private Attributes

 $token_handler = null
 

Detailed Description

@classDescription Handles requests from external calendar applications

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 34 of file class.ilCalendarRemoteAccessHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarRemoteAccessHandler::__construct ( )

Constructor.

Definition at line 46 of file class.ilCalendarRemoteAccessHandler.php.

47 {
48 }

Member Function Documentation

◆ getTokenHandler()

ilCalendarRemoteAccessHandler::getTokenHandler ( )
Returns
ilCalendarAuthenticationHandler

Definition at line 53 of file class.ilCalendarRemoteAccessHandler.php.

References $token_handler.

Referenced by handleRequest(), and initUser().

+ Here is the caller graph for this function:

◆ handleRequest()

ilCalendarRemoteAccessHandler::handleRequest ( )

Handle Request.

Returns

Definition at line 76 of file class.ilCalendarRemoteAccessHandler.php.

77 {
78 session_name('ILCALSESSID');
79 $this->initIlias();
80 $logger = $GLOBALS['DIC']->logger()->cal();
81 $this->initTokenHandler();
82 $this->initLimitEnabled();
83
84 if (!$this->initUser()) {
85 $logger->warning('Calendar token is invalid. Authentication failed.');
86 return false;
87 }
88
89 if ($this->getTokenHandler()->getIcal() and !$this->getTokenHandler()->isIcalExpired()) {
90 $GLOBALS['DIC']['ilAuthSession']->logout();
91 ilUtil::deliverData($this->getTokenHandler(), 'calendar.ics', 'text/calendar', 'utf-8');
92 exit;
93 }
94
95 include_once './Services/Calendar/classes/Export/class.ilCalendarExport.php';
96 include_once './Services/Calendar/classes/class.ilCalendarCategories.php';
97 if ($this->getTokenHandler()->getSelectionType() == ilCalendarAuthenticationToken::SELECTION_CALENDAR) {
98 #$export = new ilCalendarExport(array($this->getTokenHandler()->getCalendar()));
100 $cats->initialize(ilCalendarCategories::MODE_REMOTE_SELECTED, $this->getTokenHandler()->getCalendar());
101 $export = new ilCalendarExport($cats->getCategories(true), $this->limit_enabled);
102 } else {
105 $export = new ilCalendarExport($cats->getCategories(true), $this->limit_enabled);
106 }
107
108 $export->export();
109
110 $this->getTokenHandler()->setIcal($export->getExportString());
111 $this->getTokenHandler()->storeIcal();
112
113 $GLOBALS['DIC']['ilAuthSession']->logout();
114 ilUtil::deliverData($export->getExportString(), 'calendar.ics', 'text/calendar', 'utf-8');
115 exit;
116 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static _getInstance($a_usr_id=0)
get singleton instance
@classDescription Export calendar(s) to ical format
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
exit
Definition: login.php:29

References $GLOBALS, ilCalendarCategories\_getInstance(), ilUtil\deliverData(), exit, getTokenHandler(), initIlias(), initLimitEnabled(), initTokenHandler(), initUser(), ilCalendarCategories\MODE_REMOTE_ACCESS, ilCalendarCategories\MODE_REMOTE_SELECTED, and ilCalendarAuthenticationToken\SELECTION_CALENDAR.

+ Here is the call graph for this function:

◆ initIlias()

ilCalendarRemoteAccessHandler::initIlias ( )
protected

Definition at line 133 of file class.ilCalendarRemoteAccessHandler.php.

134 {
135 include_once "Services/Context/classes/class.ilContext.php";
137
138 include_once './Services/Authentication/classes/class.ilAuthFactory.php';
140
141 require_once("Services/Init/classes/class.ilInitialisation.php");
143
144 $GLOBALS['DIC']['lng']->loadLanguageModule('dateplaner');
145 }
static setContext($a_context)
set context
static init($a_type)
Init context by type.
const CONTEXT_ICAL
static initILIAS()
ilias initialisation

References $GLOBALS, ilAuthFactory\CONTEXT_CALENDAR_TOKEN, ilContext\CONTEXT_ICAL, ilContext\init(), ilInitialisation\initILIAS(), and ilAuthFactory\setContext().

Referenced by handleRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initLimitEnabled()

ilCalendarRemoteAccessHandler::initLimitEnabled ( )
protected

Definition at line 128 of file class.ilCalendarRemoteAccessHandler.php.

129 {
130 $this->limit_enabled = (bool) $_GET[self::LIMITED_QUERY_PARAM];
131 }
$_GET["client_id"]

References $_GET.

Referenced by handleRequest().

+ Here is the caller graph for this function:

◆ initTokenHandler()

ilCalendarRemoteAccessHandler::initTokenHandler ( )
protected

Definition at line 118 of file class.ilCalendarRemoteAccessHandler.php.

119 {
120 $GLOBALS['DIC']->logger()->cal()->info('Authentication token: ' . $_GET['token']);
121 $this->token_handler = new ilCalendarAuthenticationToken(
123 $_GET['token']
124 );
125 return true;
126 }
Handles calendar authentication tokens for external calendar subscriptions.
static lookupUser($a_token)
Lookup user by hash.

References $_GET, $GLOBALS, and ilCalendarAuthenticationToken\lookupUser().

Referenced by handleRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initUser()

ilCalendarRemoteAccessHandler::initUser ( )
protected

Init user.

Returns
boolean

Definition at line 151 of file class.ilCalendarRemoteAccessHandler.php.

152 {
153 if (!$this->getTokenHandler() instanceof ilCalendarAuthenticationToken) {
154 $GLOBALS['DIC']->logger()->cal()->info('Initialisation of authentication token failed');
155 return false;
156 }
157 if (!$this->getTokenHandler()->getUserId()) {
158 $GLOBALS['DIC']->logger()->cal()->info('No user id found for calendar synchronisation');
159 return false;
160 }
161 include_once './Services/User/classes/class.ilObjUser.php';
162 if (!ilObjUser::_exists($this->getTokenHandler()->getUserId())) {
163 $GLOBALS['DIC']->logger()->cal()->notice('No valid user id found for calendar synchronisation');
164 return false;
165 }
166
167 include_once './Services/Init/classes/class.ilInitialisation.php';
168 $GLOBALS['DIC']['ilAuthSession']->setAuthenticated(true, $this->getTokenHandler()->getUserId());
170
171 if (!$GLOBALS['DIC']->user() instanceof ilObjUser) {
172 $GLOBALS['DIC']->logger()->cal()->debug('no user object defined');
173 } else {
174 $GLOBALS['DIC']->logger()->cal()->debug('Current user is: ' . $GLOBALS['DIC']->user()->getId());
175 }
176 return true;
177 }
user()
Definition: user.php:4
static initUserAccount()
Init user with current account id.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public

References $GLOBALS, ilObject\_exists(), getTokenHandler(), ilInitialisation\initUserAccount(), and user().

Referenced by handleRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseRequest()

ilCalendarRemoteAccessHandler::parseRequest ( )

Fetch client id, the chosen calendar...

Returns

Definition at line 62 of file class.ilCalendarRemoteAccessHandler.php.

63 {
64 if ($_GET['client_id']) {
65 $_COOKIE['ilClientId'] = $_GET['client_id'];
66 } else {
67 $path_info_components = explode('/', $_SERVER['PATH_INFO']);
68 $_COOKIE['ilClientId'] = $path_info_components[1];
69 }
70 }
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
$path_info_components
Definition: webdav.php:16
$_COOKIE[session_name()]
Definition: xapitoken.php:37

References $_COOKIE, $_GET, $_SERVER, and $path_info_components.

Field Documentation

◆ $limit_enabled

ilCalendarRemoteAccessHandler::$limit_enabled
protected

Definition at line 41 of file class.ilCalendarRemoteAccessHandler.php.

◆ $token_handler

ilCalendarRemoteAccessHandler::$token_handler = null
private

Definition at line 37 of file class.ilCalendarRemoteAccessHandler.php.

Referenced by getTokenHandler().

◆ LIMITED_QUERY_PARAM

const ilCalendarRemoteAccessHandler::LIMITED_QUERY_PARAM = 'limited'
protected

Definition at line 36 of file class.ilCalendarRemoteAccessHandler.php.


The documentation for this class was generated from the following file: