Ejemplo n.º 1
0
 /**
  * @throws Kronolith_Exception
  */
 public function execute()
 {
     // If cancel was clicked, return false.
     if ($this->_vars->get('submitbutton') == _("Cancel")) {
         Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
     }
     if (!$this->_resource->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) {
         throw new Kronolith_Exception(_("Permission denied"));
     }
     // Delete the resource.
     try {
         Kronolith::getDriver('Resource')->delete($this->_resource);
     } catch (Exception $e) {
         throw new Kronolith_Exception(sprintf(_("Unable to delete \"%s\": %s"), $this->_resource->get('name'), $e->getMessage()));
     }
 }
Ejemplo n.º 2
0
 /**
  * Encapsulates permissions checking.
  *
  * @param integer $permission  The permission to check for.
  * @param string $user         The user to check permissions for. Defaults
  *                             to the current user.
  * @param string $creator      An event creator, to check for creator
  *                             permissions.
  *
  * @return boolean  Whether the user has the permission on this calendar.
  */
 public function hasPermission($permission, $user = null, $creator = null)
 {
     return $this->_resource->hasPermission($user, $permission, $creator);
 }