Exemplo n.º 1
0
 /**
  * @see AbstractCalendarPermission for a complete list of available actions
  * 
  * @param array $params(
  * 		'calendarId' => calendarId,
  * 		'collaboratorId' => collaboratorId,
  * 		'permissionActions' => 'share, edit, see, see_details'
  * )
  */
 public static function shareCalendar($params)
 {
     if (!isset($params['calendarId']) || !is_string($params['calendarId'])) {
         throw new EyeMissingArgumentException('Missing or invalid $params[\'calendarId\'].');
     }
     if (!isset($params['collaboratorId']) || !is_string($params['collaboratorId'])) {
         throw new EyeMissingArgumentException('Missing or invalid $params[\'collaboratorId\'].');
     }
     if (!isset($params['permissionActions']) || !is_string($params['permissionActions'])) {
         throw new EyeMissingArgumentException('Missing or invalid $params[\'permissionActions\'].');
     }
     $cal = CalendarManager::getInstance()->getCalendarById($params['calendarId']);
     $collaborator = UMManager::getPrincipalById($params['collaboratorId']);
     $perms = new AbstractCalendarPermission($params['permissionActions']);
     $cal->addCollaborator($collaborator, $perms);
 }