当前位置: 首页>>代码示例>>PHP>>正文


PHP Kronolith::hasPermission方法代码示例

本文整理汇总了PHP中Kronolith::hasPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::hasPermission方法的具体用法?PHP Kronolith::hasPermission怎么用?PHP Kronolith::hasPermission使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kronolith的用法示例。


在下文中一共展示了Kronolith::hasPermission方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _getDriver

 /**
  * Returns the driver object for a calendar.
  *
  * @param string $cal  A calendar string in the format "type|name".
  *
  * @return Kronolith_Driver|boolean  A driver instance or false on failure.
  */
 protected function _getDriver($cal)
 {
     list($driver, $calendar) = explode('|', $cal);
     if ($driver == 'internal' && !Kronolith::hasPermission($calendar, Horde_Perms::SHOW)) {
         $GLOBALS['notification']->push(_("Permission Denied"), 'horde.error');
         return false;
     }
     try {
         $kronolith_driver = Kronolith::getDriver($driver, $calendar);
     } catch (Exception $e) {
         $GLOBALS['notification']->push($e, 'horde.error');
         return false;
     }
     if ($driver == 'remote') {
         $kronolith_driver->setParam('timeout', 15);
     }
     return $kronolith_driver;
 }
开发者ID:kossamums,项目名称:horde,代码行数:25,代码来源:Handler.php

示例2: davDeleteObject

 /**
  */
 public function davDeleteObject($collection, $object)
 {
     $dav = $GLOBALS['injector']->getInstance('Horde_Dav_Storage');
     $internal = $dav->getInternalCollectionId($collection, 'calendar') ?: $collection;
     if (!Kronolith::hasPermission($internal, Horde_Perms::DELETE)) {
         throw new Kronolith_Exception(_("Calendar does not exist or no permission to delete"));
     }
     try {
         $object = $dav->getInternalObjectId($object, $internal) ?: preg_replace('/\\.ics$/', '', $object);
     } catch (Horde_Dav_Exception $e) {
     }
     $kronolith_driver = Kronolith::getDriver(null, $internal);
     $event = $kronolith_driver->getEvent($object);
     $kronolith_driver->deleteEvent($object);
     try {
         $dav->deleteExternalObjectId($object, $internal);
     } catch (Horde_Dav_Exception $e) {
     }
     // Send iTip messages unless organizer is external.
     // Notifications will get lost, there is no way to return messages to
     // clients.
     if ($event->organizer && !Kronolith::isUserEmail($event->creator, $event->organizer)) {
         return;
     }
     Kronolith::sendITipNotifications($event, new Horde_Notification_Handler(new Horde_Notification_Storage_Object()), Kronolith::ITIP_CANCEL);
 }
开发者ID:horde,项目名称:horde,代码行数:28,代码来源:Application.php

示例3: checkLocks

 /**
  * Check for existing calendar or event locks.
  *
  * @param array $calendar  The calendar to check locks for.
  * @param array $event     The event to check locks for.
  *
  * @throws Kronolith_Exception
  */
 public function checkLocks($calendar, $event = null)
 {
     if (!Kronolith::hasPermission($calendar, Horde_Perms::READ)) {
         throw new Horde_Exception_PermissionDenied();
     }
     if (!empty($event)) {
         $uid = $calendar . ':' . $event;
     }
     return $GLOBALS['injector']->getInstance('Kronolith_Shares')->getShare($calendar)->checkLocks($GLOBALS['injector']->getInstance('Horde_Lock'), $uid);
 }
开发者ID:horde,项目名称:horde,代码行数:18,代码来源:Api.php

示例4: list

 * Copyright 2016 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file LICENSE for license information (ASL).  If you
 * did not receive this file, see http://www.horde.org/licenses/apache.
 *
 * @author Jan Schneider <jan@horde.org>
 * @author Michael J Rubinsky <mrubinsk@horde.org>
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('kronolith');
$source = Horde_Util::getFormData('source');
$key = Horde_Util::getFormData('key');
$filename = Horde_Util::getFormData('file');
$type = Horde_Util::getFormData('type');
list($driver_type, $calendar) = explode('|', $source);
if ($driver_type == 'internal' && !Kronolith::hasPermission($calendar, Horde_Perms::SHOW)) {
    $GLOBALS['notification']->push(_("Permission Denied"), 'horde.error');
    return false;
}
try {
    $driver = Kronolith::getDriver($driver_type, $calendar);
} catch (Exception $e) {
    $GLOBALS['notification']->push($e, 'horde.error');
    return false;
}
$event = $driver->getEvent($key);
/* Check permissions. */
if (!$event->hasPermission(Horde_Perms::READ)) {
    throw new Kronolith_Exception(_("You do not have permission to view this event."));
}
try {
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:viewer.php


注:本文中的Kronolith::hasPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。