public function removeGallery($gallery_id, array $params = array())
{
// Check global Ansel permissions
if (!$GLOBALS['injector']->getInstance('Horde_Perms')->getPermissions('ansel', $GLOBALS['registry']->getAuth())) {
throw new Horde_Exception_PermissionDenied(_("Access denied deleting galleries."));
}
// Custom scope, if needed
if (!empty($params['scope'])) {
$GLOBALS['injector']->getInstance('Ansel_Config')->set('scope', $params['scope']);
}
// Get, and check perms on the gallery
$gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($gallery_id);
if (!$gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) {
throw new Horde_Exception_PermissionDenied(_("Access denied deleting this gallery."));
} else {
$GLOBALS['injector']->getInstance('Ansel_Storage')->removeGallery($gallery);
}
}