mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Fix story picture definition
This commit is contained in:
@@ -77,7 +77,7 @@ return call_user_func(
|
||||
$databox = \databox::get_instance((int) $sbas_id);
|
||||
$record = new \record_adapter($sbas_id, $record_id);
|
||||
|
||||
if ( ! $session->is_authenticated()) {
|
||||
if (!$session->is_authenticated()) {
|
||||
throw new \Exception_Session_NotAuthenticated();
|
||||
}
|
||||
|
||||
@@ -90,20 +90,21 @@ return call_user_func(
|
||||
if ($subdefObj->get_class() == 'thumbnail') {
|
||||
$all_access = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$user = \User_Adapter::getInstance($session->get_usr_id(), \appbox::get_instance($app['Core']));
|
||||
|
||||
if ( ! $user->ACL()->has_access_to_subdef($record, $subdef)) {
|
||||
if (!$user->ACL()->has_access_to_subdef($record, $subdef)) {
|
||||
throw new \Exception_UnauthorizedAction();
|
||||
}
|
||||
|
||||
$stamp = false;
|
||||
$watermark = ! $user->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark');
|
||||
$watermark = !$user->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark');
|
||||
|
||||
if ($watermark && ! $all_access) {
|
||||
if ($watermark && !$all_access) {
|
||||
$subdef_class = $databox
|
||||
->get_subdef_structure()
|
||||
->get_subdef($record->get_type(), $subdef)
|
||||
@@ -116,7 +117,7 @@ return call_user_func(
|
||||
}
|
||||
}
|
||||
|
||||
if ($watermark && ! $all_access) {
|
||||
if ($watermark && !$all_access) {
|
||||
|
||||
$em = $app['Core']->getEntityManager();
|
||||
|
||||
@@ -144,7 +145,7 @@ return call_user_func(
|
||||
|
||||
$record = \media_Permalink_Adapter::challenge_token($databox, $key, $record_id, $subdef);
|
||||
|
||||
if ( ! ($record instanceof \record_adapter))
|
||||
if (!($record instanceof \record_adapter))
|
||||
throw new \Exception('bad luck');
|
||||
|
||||
/* @var $twig \Twig_Environment */
|
||||
@@ -165,7 +166,7 @@ return call_user_func(
|
||||
, function($label, $sbas_id, $record_id, $key, $subdef) use ($app, $session, $deliver_content) {
|
||||
$databox = \databox::get_instance((int) $sbas_id);
|
||||
$record = \media_Permalink_Adapter::challenge_token($databox, $key, $record_id, $subdef);
|
||||
if ( ! ($record instanceof \record_adapter))
|
||||
if (!($record instanceof \record_adapter))
|
||||
throw new \Exception('bad luck');
|
||||
|
||||
$watermark = $stamp = false;
|
||||
@@ -173,7 +174,7 @@ return call_user_func(
|
||||
if ($session->is_authenticated()) {
|
||||
$user = \User_Adapter::getInstance($session->get_usr_id(), \appbox::get_instance($app['Core']));
|
||||
|
||||
$watermark = ! $user->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark');
|
||||
$watermark = !$user->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark');
|
||||
|
||||
if ($watermark) {
|
||||
|
||||
|
@@ -198,6 +198,14 @@ class ACL implements cache_cacheableInterface
|
||||
|
||||
public function has_access_to_subdef(record_Interface $record, $subdef_name)
|
||||
{
|
||||
if ($subdef_name == 'thumbnail') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($record->is_grouping()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
$subdef_class = $record->get_databox()->get_subdef_structure()
|
||||
->get_subdef($record->get_type(), $subdef_name)
|
||||
@@ -205,6 +213,7 @@ class ACL implements cache_cacheableInterface
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$granted = false;
|
||||
|
||||
if ($subdef_class == databox_subdef::CLASS_THUMBNAIL) {
|
||||
@@ -215,7 +224,7 @@ class ACL implements cache_cacheableInterface
|
||||
$granted = true;
|
||||
} elseif ($subdef_class == databox_subdef::CLASS_DOCUMENT && $this->has_right_on_base($record->get_base_id(), 'candwnldhd')) {
|
||||
$granted = true;
|
||||
} elseif ($subdef_class == databox_subdef::CLASS_DOCUMENT && $user->ACL()->has_hd_grant($record)) {
|
||||
} elseif ($subdef_class == databox_subdef::CLASS_DOCUMENT && $this->has_hd_grant($record)) {
|
||||
$granted = true;
|
||||
}
|
||||
|
||||
|
@@ -1053,7 +1053,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
|
||||
$subdef_def = $this->get_databox()->get_subdef_structure()->get_subdef($type, $name);
|
||||
|
||||
if ($this->has_subdef($name) && ! $this->get_subdef($name)->is_substituted()) {
|
||||
if ($this->has_subdef($name) && $this->get_subdef($name)->is_physically_present()) {
|
||||
|
||||
$path_file_dest = $this->get_subdef($name)->get_pathfile();
|
||||
$this->get_subdef($name)->remove_file();
|
||||
|
Reference in New Issue
Block a user