mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 11:33:17 +00:00
Remove user variable assignment
This commit is contained in:
@@ -159,7 +159,6 @@ return call_user_func(function($environment = 'prod') {
|
|||||||
* Check wether the current user is Admin or not
|
* Check wether the current user is Admin or not
|
||||||
*/
|
*/
|
||||||
$mustBeAdmin = function (Request $request) use ($app) {
|
$mustBeAdmin = function (Request $request) use ($app) {
|
||||||
/* @var $user \User_Adapter */
|
|
||||||
$user = $app['token']->get_account()->get_user();
|
$user = $app['token']->get_account()->get_user();
|
||||||
if (!$user->ACL()->is_admin()) {
|
if (!$user->ACL()->is_admin()) {
|
||||||
throw new \API_V1_exception_unauthorized('You are not authorized');
|
throw new \API_V1_exception_unauthorized('You are not authorized');
|
||||||
|
@@ -344,20 +344,19 @@ class Lightbox implements ControllerProviderInterface
|
|||||||
'datas' => _('Erreur lors de la mise a jour des donnes ')
|
'datas' => _('Erreur lors de la mise a jour des donnes ')
|
||||||
);
|
);
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
$repository = $app['EM']->getRepository('\Entities\BasketElement');
|
$repository = $app['EM']->getRepository('\Entities\BasketElement');
|
||||||
|
|
||||||
/* @var $repository \Repositories\BasketElementRepository */
|
/* @var $repository \Repositories\BasketElementRepository */
|
||||||
$basket_element = $repository->findUserElement(
|
$basket_element = $repository->findUserElement(
|
||||||
$sselcont_id
|
$sselcont_id
|
||||||
, $user
|
, $app['phraseanet.user']
|
||||||
);
|
);
|
||||||
/* @var $basket_element \Entities\BasketElement */
|
/* @var $basket_element \Entities\BasketElement */
|
||||||
$validationDatas = $basket_element->getUserValidationDatas($user, $app);
|
$validationDatas = $basket_element->getUserValidationDatas($app['phraseanet.user'], $app);
|
||||||
|
|
||||||
if (!$basket_element->getBasket()
|
if (!$basket_element->getBasket()
|
||||||
->getValidation()
|
->getValidation()
|
||||||
->getParticipant($user, $app)->getCanAgree()) {
|
->getParticipant($app['phraseanet.user'], $app)->getCanAgree()) {
|
||||||
throw new ControllerException('You can not agree on this');
|
throw new ControllerException('You can not agree on this');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +364,7 @@ class Lightbox implements ControllerProviderInterface
|
|||||||
|
|
||||||
$participant = $basket_element->getBasket()
|
$participant = $basket_element->getBasket()
|
||||||
->getValidation()
|
->getValidation()
|
||||||
->getParticipant($user, $app);
|
->getParticipant($app['phraseanet.user'], $app);
|
||||||
|
|
||||||
$app['EM']->merge($basket_element);
|
$app['EM']->merge($basket_element);
|
||||||
|
|
||||||
@@ -390,8 +389,6 @@ class Lightbox implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->post('/ajax/SET_RELEASE/{ssel_id}/', function(SilexApplication $app, $ssel_id) {
|
$controllers->post('/ajax/SET_RELEASE/{ssel_id}/', function(SilexApplication $app, $ssel_id) {
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$repository = $app['EM']->getRepository('\Entities\Basket');
|
$repository = $app['EM']->getRepository('\Entities\Basket');
|
||||||
|
|
||||||
$datas = array('error' => true, 'datas' => '');
|
$datas = array('error' => true, 'datas' => '');
|
||||||
@@ -400,7 +397,7 @@ class Lightbox implements ControllerProviderInterface
|
|||||||
/* @var $repository \Repositories\BasketRepository */
|
/* @var $repository \Repositories\BasketRepository */
|
||||||
$basket = $repository->findUserBasket(
|
$basket = $repository->findUserBasket(
|
||||||
$app, $ssel_id
|
$app, $ssel_id
|
||||||
, $user
|
, $app['phraseanet.user']
|
||||||
, false
|
, false
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -408,12 +405,12 @@ class Lightbox implements ControllerProviderInterface
|
|||||||
throw new ControllerException('There is no validation session attached to this basket');
|
throw new ControllerException('There is no validation session attached to this basket');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$basket->getValidation()->getParticipant($user, $app)->getCanAgree()) {
|
if (!$basket->getValidation()->getParticipant($app['phraseanet.user'], $app)->getCanAgree()) {
|
||||||
throw new ControllerException('You have not right to agree');
|
throw new ControllerException('You have not right to agree');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @var $basket \Entities\Basket */
|
/* @var $basket \Entities\Basket */
|
||||||
$participant = $basket->getValidation()->getParticipant($user, $app);
|
$participant = $basket->getValidation()->getParticipant($app['phraseanet.user'], $app);
|
||||||
|
|
||||||
$evt_mngr = $app['events-manager'];
|
$evt_mngr = $app['events-manager'];
|
||||||
|
|
||||||
|
@@ -223,12 +223,10 @@ class Dashboard implements ControllerProviderInterface
|
|||||||
*/
|
*/
|
||||||
public function addAdmins(Application $app, Request $request)
|
public function addAdmins(Application $app, Request $request)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
if (count($admins = $request->request->get('admins', array())) > 0) {
|
if (count($admins = $request->request->get('admins', array())) > 0) {
|
||||||
|
|
||||||
if (!in_array($user->get_id(), $admins)) {
|
if (!in_array($app['phraseanet.user']->get_id(), $admins)) {
|
||||||
$admins[] = $user->get_id();
|
$admins[] = $app['phraseanet.user']->get_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($admins > 0) {
|
if ($admins > 0) {
|
||||||
|
@@ -652,11 +652,9 @@ class Databox implements ControllerProviderInterface
|
|||||||
*/
|
*/
|
||||||
public function mountCollection(Application $app, Request $request, $databox_id, $collection_id)
|
public function mountCollection(Application $app, Request $request, $databox_id, $collection_id)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$app['phraseanet.appbox']->get_connection()->beginTransaction();
|
$app['phraseanet.appbox']->get_connection()->beginTransaction();
|
||||||
try {
|
try {
|
||||||
$baseId = \collection::mount_collection($app, $app['phraseanet.appbox']->get_databox($databox_id), $collection_id, $user);
|
$baseId = \collection::mount_collection($app, $app['phraseanet.appbox']->get_databox($databox_id), $collection_id, $app['phraseanet.user']);
|
||||||
|
|
||||||
if (null == $othCollSel = $request->request->get("othcollsel")) {
|
if (null == $othCollSel = $request->request->get("othcollsel")) {
|
||||||
$app->abort(400);
|
$app->abort(400);
|
||||||
|
@@ -121,11 +121,9 @@ class Databoxes implements ControllerProviderInterface
|
|||||||
$upgradeAvailable = true;
|
$upgradeAvailable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$sbasIds = array_merge(
|
$sbasIds = array_merge(
|
||||||
array_keys($user->ACL()->get_granted_sbas(array('bas_manage')))
|
array_keys($app['phraseanet.user']->ACL()->get_granted_sbas(array('bas_manage')))
|
||||||
, array_keys($user->ACL()->get_granted_sbas(array('bas_modify_struct')))
|
, array_keys($app['phraseanet.user']->ACL()->get_granted_sbas(array('bas_modify_struct')))
|
||||||
);
|
);
|
||||||
|
|
||||||
$sbas = array();
|
$sbas = array();
|
||||||
|
@@ -92,11 +92,9 @@ class Publications implements ControllerProviderInterface
|
|||||||
|
|
||||||
$feed = new \Feed_Adapter($app, $id);
|
$feed = new \Feed_Adapter($app, $id);
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$request = $app["request"];
|
$request = $app["request"];
|
||||||
|
|
||||||
if (!$feed->is_owner($user)) {
|
if (!$feed->is_owner($app['phraseanet.user'])) {
|
||||||
$datas['message'] = 'You are not allowed to do that';
|
$datas['message'] = 'You are not allowed to do that';
|
||||||
|
|
||||||
return $app->json($datas);
|
return $app->json($datas);
|
||||||
|
@@ -38,8 +38,6 @@ class Root implements ControllerProviderInterface
|
|||||||
});
|
});
|
||||||
|
|
||||||
$controllers->get('/', function(Application $app, Request $request) {
|
$controllers->get('/', function(Application $app, Request $request) {
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
\User_Adapter::updateClientInfos($app, 3);
|
\User_Adapter::updateClientInfos($app, 3);
|
||||||
|
|
||||||
$section = $request->query->get('section', false);
|
$section = $request->query->get('section', false);
|
||||||
@@ -71,7 +69,7 @@ class Root implements ControllerProviderInterface
|
|||||||
$databoxes = $off_databoxes = array();
|
$databoxes = $off_databoxes = array();
|
||||||
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||||
try {
|
try {
|
||||||
if (!$user->ACL()->has_access_to_sbas($databox->get_sbas_id())) {
|
if (!$app['phraseanet.user']->ACL()->has_access_to_sbas($databox->get_sbas_id())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$databox->get_connection();
|
$databox->get_connection();
|
||||||
@@ -104,8 +102,6 @@ class Root implements ControllerProviderInterface
|
|||||||
})->bind('admin');
|
})->bind('admin');
|
||||||
|
|
||||||
$controllers->get('/tree/', function(Application $app, Request $request) {
|
$controllers->get('/tree/', function(Application $app, Request $request) {
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
\User_Adapter::updateClientInfos($app, 3);
|
\User_Adapter::updateClientInfos($app, 3);
|
||||||
|
|
||||||
$section = $request->query->get('section', false);
|
$section = $request->query->get('section', false);
|
||||||
@@ -138,7 +134,7 @@ class Root implements ControllerProviderInterface
|
|||||||
$databoxes = $off_databoxes = array();
|
$databoxes = $off_databoxes = array();
|
||||||
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||||
try {
|
try {
|
||||||
if (!$user->ACL()->has_access_to_sbas($databox->get_sbas_id())) {
|
if (!$app['phraseanet.user']->ACL()->has_access_to_sbas($databox->get_sbas_id())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -197,8 +197,6 @@ class Users implements ControllerProviderInterface
|
|||||||
|
|
||||||
$user_query = new \User_Query($app);
|
$user_query = new \User_Query($app);
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$like_value = $request->query->get('term');
|
$like_value = $request->query->get('term');
|
||||||
$rights = $request->query->get('filter_rights') ? : array();
|
$rights = $request->query->get('filter_rights') ? : array();
|
||||||
$have_right = $request->query->get('have_right') ? : array();
|
$have_right = $request->query->get('have_right') ? : array();
|
||||||
@@ -206,7 +204,7 @@ class Users implements ControllerProviderInterface
|
|||||||
$on_base = $request->query->get('on_base') ? : array();
|
$on_base = $request->query->get('on_base') ? : array();
|
||||||
|
|
||||||
$elligible_users = $user_query
|
$elligible_users = $user_query
|
||||||
->on_sbas_where_i_am($user->ACL(), $rights)
|
->on_sbas_where_i_am($app['phraseanet.user']->ACL(), $rights)
|
||||||
->like(\User_Query::LIKE_EMAIL, $like_value)
|
->like(\User_Query::LIKE_EMAIL, $like_value)
|
||||||
->like(\User_Query::LIKE_FIRSTNAME, $like_value)
|
->like(\User_Query::LIKE_FIRSTNAME, $like_value)
|
||||||
->like(\User_Query::LIKE_LASTNAME, $like_value)
|
->like(\User_Query::LIKE_LASTNAME, $like_value)
|
||||||
@@ -259,13 +257,12 @@ class Users implements ControllerProviderInterface
|
|||||||
$request = $app['request'];
|
$request = $app['request'];
|
||||||
$user_query = new \User_Query($app);
|
$user_query = new \User_Query($app);
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
$like_value = $request->request->get('like_value');
|
$like_value = $request->request->get('like_value');
|
||||||
$like_field = $request->request->get('like_field');
|
$like_field = $request->request->get('like_field');
|
||||||
$on_base = $request->request->get('base_id') ? : null;
|
$on_base = $request->request->get('base_id') ? : null;
|
||||||
$on_sbas = $request->request->get('sbas_id') ? : null;
|
$on_sbas = $request->request->get('sbas_id') ? : null;
|
||||||
|
|
||||||
$elligible_users = $user_query->on_bases_where_i_am($user->ACL(), array('canadmin'))
|
$elligible_users = $user_query->on_bases_where_i_am($app['phraseanet.user']->ACL(), array('canadmin'))
|
||||||
->like($like_field, $like_value)
|
->like($like_field, $like_value)
|
||||||
->on_base_ids($on_base)
|
->on_base_ids($on_base)
|
||||||
->on_sbas_ids($on_sbas);
|
->on_sbas_ids($on_sbas);
|
||||||
@@ -332,7 +329,6 @@ class Users implements ControllerProviderInterface
|
|||||||
});
|
});
|
||||||
|
|
||||||
$controllers->get('/demands/', function(Application $app, Request $request) {
|
$controllers->get('/demands/', function(Application $app, Request $request) {
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$lastMonth = time() - (3 * 4 * 7 * 24 * 60 * 60);
|
$lastMonth = time() - (3 * 4 * 7 * 24 * 60 * 60);
|
||||||
$sql = "DELETE FROM demand WHERE date_modif < :date";
|
$sql = "DELETE FROM demand WHERE date_modif < :date";
|
||||||
@@ -340,12 +336,12 @@ class Users implements ControllerProviderInterface
|
|||||||
$stmt->execute(array(':date' => date('Y-m-d', $lastMonth)));
|
$stmt->execute(array(':date' => date('Y-m-d', $lastMonth)));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$baslist = array_keys($user->ACL()->get_granted_base(array('canadmin')));
|
$baslist = array_keys($app['phraseanet.user']->ACL()->get_granted_base(array('canadmin')));
|
||||||
|
|
||||||
$sql = 'SELECT usr_id, usr_login FROM usr WHERE model_of = :usr_id';
|
$sql = 'SELECT usr_id, usr_login FROM usr WHERE model_of = :usr_id';
|
||||||
|
|
||||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':usr_id' => $user->get_id()));
|
$stmt->execute(array(':usr_id' => $app['phraseanet.user']->get_id()));
|
||||||
$models = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
$models = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
@@ -561,7 +557,6 @@ class Users implements ControllerProviderInterface
|
|||||||
})->bind('users_display_import_file');
|
})->bind('users_display_import_file');
|
||||||
|
|
||||||
$controllers->post('/import/file/', function(Application $app, Request $request) {
|
$controllers->post('/import/file/', function(Application $app, Request $request) {
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
if ((null === $file = $request->files->get('files')) || !$file->isValid()) {
|
if ((null === $file = $request->files->get('files')) || !$file->isValid()) {
|
||||||
|
|
||||||
@@ -678,12 +673,12 @@ class Users implements ControllerProviderInterface
|
|||||||
INNER JOIN basusr
|
INNER JOIN basusr
|
||||||
ON (basusr.usr_id=usr.usr_id)
|
ON (basusr.usr_id=usr.usr_id)
|
||||||
WHERE usr.model_of = :usr_id
|
WHERE usr.model_of = :usr_id
|
||||||
AND base_id in(" . implode(', ', array_keys($user->ACL()->get_granted_base(array('manage')))) . ")
|
AND base_id in(" . implode(', ', array_keys($app['phraseanet.user']->ACL()->get_granted_base(array('manage')))) . ")
|
||||||
AND usr_login not like '(#deleted_%)'
|
AND usr_login not like '(#deleted_%)'
|
||||||
GROUP BY usr_id";
|
GROUP BY usr_id";
|
||||||
|
|
||||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':usr_id' => $user->get_id()));
|
$stmt->execute(array(':usr_id' => $app['phraseanet.user']->get_id()));
|
||||||
$models = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
$models = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
@@ -697,7 +692,6 @@ class Users implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->post('/import/', function(Application $app, Request $request) {
|
$controllers->post('/import/', function(Application $app, Request $request) {
|
||||||
$nbCreation = 0;
|
$nbCreation = 0;
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
if ((null === $serializedArray = $request->request->get('sr')) || ('' === $serializedArray)) {
|
if ((null === $serializedArray = $request->request->get('sr')) || ('' === $serializedArray)) {
|
||||||
$app->abort(400);
|
$app->abort(400);
|
||||||
@@ -763,7 +757,7 @@ class Users implements ControllerProviderInterface
|
|||||||
$NewUser = \User_Adapter::create($app, $curUser['usr_login'], $curUser['usr_password'], $curUser['usr_mail'], false);
|
$NewUser = \User_Adapter::create($app, $curUser['usr_login'], $curUser['usr_password'], $curUser['usr_mail'], false);
|
||||||
|
|
||||||
$NewUser->ACL()->apply_model(
|
$NewUser->ACL()->apply_model(
|
||||||
\User_Adapter::getInstance($model, $app), array_keys($user->ACL()->get_granted_base(array('manage')))
|
\User_Adapter::getInstance($model, $app), array_keys($app['phraseanet.user']->ACL()->get_granted_base(array('manage')))
|
||||||
);
|
);
|
||||||
|
|
||||||
$nbCreation++;
|
$nbCreation++;
|
||||||
|
@@ -52,18 +52,16 @@ class Datafiles extends AbstractDelivery
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
if (!$record->has_subdef($subdef) || !$record->get_subdef($subdef)->is_physically_present()) {
|
if (!$record->has_subdef($subdef) || !$record->get_subdef($subdef)->is_physically_present()) {
|
||||||
throw new NotFoundHttpException;
|
throw new NotFoundHttpException;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user->ACL()->has_access_to_subdef($record, $subdef)) {
|
if (!$app['phraseanet.user']->ACL()->has_access_to_subdef($record, $subdef)) {
|
||||||
throw new \Exception_UnauthorizedAction(sprintf('User has not access to subdef %s', $subdef));
|
throw new \Exception_UnauthorizedAction(sprintf('User has not access to subdef %s', $subdef));
|
||||||
}
|
}
|
||||||
|
|
||||||
$stamp = false;
|
$stamp = false;
|
||||||
$watermark = !$user->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark');
|
$watermark = !$app['phraseanet.user']->ACL()->has_right_on_base($record->get_base_id(), 'nowatermark');
|
||||||
|
|
||||||
if ($watermark && !$all_access) {
|
if ($watermark && !$all_access) {
|
||||||
$subdef_class = $databox
|
$subdef_class = $databox
|
||||||
@@ -71,9 +69,9 @@ class Datafiles extends AbstractDelivery
|
|||||||
->get_subdef($record->get_type(), $subdef)
|
->get_subdef($record->get_type(), $subdef)
|
||||||
->get_class();
|
->get_class();
|
||||||
|
|
||||||
if ($subdef_class == \databox_subdef::CLASS_PREVIEW && $user->ACL()->has_preview_grant($record)) {
|
if ($subdef_class == \databox_subdef::CLASS_PREVIEW && $app['phraseanet.user']->ACL()->has_preview_grant($record)) {
|
||||||
$watermark = false;
|
$watermark = false;
|
||||||
} elseif ($subdef_class == \databox_subdef::CLASS_DOCUMENT && $user->ACL()->has_hd_grant($record)) {
|
} elseif ($subdef_class == \databox_subdef::CLASS_DOCUMENT && $app['phraseanet.user']->ACL()->has_hd_grant($record)) {
|
||||||
$watermark = false;
|
$watermark = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,8 +82,8 @@ class Datafiles extends AbstractDelivery
|
|||||||
|
|
||||||
/* @var $repository \Repositories\BasketElementRepository */
|
/* @var $repository \Repositories\BasketElementRepository */
|
||||||
|
|
||||||
$ValidationByRecord = $repository->findReceivedValidationElementsByRecord($record, $user);
|
$ValidationByRecord = $repository->findReceivedValidationElementsByRecord($record, $app['phraseanet.user']);
|
||||||
$ReceptionByRecord = $repository->findReceivedElementsByRecord($record, $user);
|
$ReceptionByRecord = $repository->findReceivedElementsByRecord($record, $app['phraseanet.user']);
|
||||||
|
|
||||||
if ($ValidationByRecord && count($ValidationByRecord) > 0) {
|
if ($ValidationByRecord && count($ValidationByRecord) > 0) {
|
||||||
$watermark = false;
|
$watermark = false;
|
||||||
|
@@ -422,15 +422,12 @@ class Basket implements ControllerProviderInterface
|
|||||||
$basket = $app['EM']->getRepository('\Entities\Basket')
|
$basket = $app['EM']->getRepository('\Entities\Basket')
|
||||||
->findUserBasket($app, $basket_id, $app['phraseanet.user'], true);
|
->findUserBasket($app, $basket_id, $app['phraseanet.user'], true);
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
/* @var $user \User_Adapter */
|
|
||||||
|
|
||||||
$n = 0;
|
$n = 0;
|
||||||
|
|
||||||
foreach ($request->request->get('elements') as $bask_element_id) {
|
foreach ($request->request->get('elements') as $bask_element_id) {
|
||||||
try {
|
try {
|
||||||
$basket_element = $app['EM']->getRepository('\Entities\BasketElement')
|
$basket_element = $app['EM']->getRepository('\Entities\BasketElement')
|
||||||
->findUserElement($bask_element_id, $user);
|
->findUserElement($bask_element_id, $app['phraseanet.user']);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@@ -55,10 +55,9 @@ class Bridge implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->post('/manager/', function(Application $app) {
|
$controllers->post('/manager/', function(Application $app) {
|
||||||
$route = new RecordHelper\Bridge($app, $app['request']);
|
$route = new RecordHelper\Bridge($app, $app['request']);
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'user_accounts' => \Bridge_Account::get_accounts_by_user($app, $user)
|
'user_accounts' => \Bridge_Account::get_accounts_by_user($app, $app['phraseanet.user'])
|
||||||
, 'available_apis' => \Bridge_Api::get_availables($app)
|
, 'available_apis' => \Bridge_Api::get_availables($app)
|
||||||
, 'route' => $route
|
, 'route' => $route
|
||||||
, 'current_account_id' => ''
|
, 'current_account_id' => ''
|
||||||
@@ -76,7 +75,6 @@ class Bridge implements ControllerProviderInterface
|
|||||||
$controllers->get('/callback/{api_name}/', function(Application $app, $api_name) {
|
$controllers->get('/callback/{api_name}/', function(Application $app, $api_name) {
|
||||||
$error_message = '';
|
$error_message = '';
|
||||||
try {
|
try {
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
$api = \Bridge_Api::get_by_api_name($app, $api_name);
|
$api = \Bridge_Api::get_by_api_name($app, $api_name);
|
||||||
$connector = $api->get_connector();
|
$connector = $api->get_connector();
|
||||||
|
|
||||||
@@ -85,9 +83,9 @@ class Bridge implements ControllerProviderInterface
|
|||||||
$user_id = $connector->get_user_id();
|
$user_id = $connector->get_user_id();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$account = \Bridge_Account::load_account_from_distant_id($app, $api, $user, $user_id);
|
$account = \Bridge_Account::load_account_from_distant_id($app, $api, $app['phraseanet.user'], $user_id);
|
||||||
} catch (\Bridge_Exception_AccountNotFound $e) {
|
} catch (\Bridge_Exception_AccountNotFound $e) {
|
||||||
$account = \Bridge_Account::create($app, $api, $user, $user_id, $connector->get_user_name());
|
$account = \Bridge_Account::create($app, $api, $app['phraseanet.user'], $user_id, $connector->get_user_name());
|
||||||
}
|
}
|
||||||
$settings = $account->get_settings();
|
$settings = $account->get_settings();
|
||||||
|
|
||||||
|
@@ -33,8 +33,7 @@ class Feed implements ControllerProviderInterface
|
|||||||
* I got a selection of docs, which publications are available forthese docs ?
|
* I got a selection of docs, which publications are available forthese docs ?
|
||||||
*/
|
*/
|
||||||
$controllers->post('/requestavailable/', function(Application $app, Request $request) {
|
$controllers->post('/requestavailable/', function(Application $app, Request $request) {
|
||||||
$user = $app['phraseanet.user'];
|
$feeds = \Feed_Collection::load_all($app, $app['phraseanet.user']);
|
||||||
$feeds = \Feed_Collection::load_all($app, $user);
|
|
||||||
$publishing = RecordsRequest::fromRequest($app, $request, true, array(), array('bas_chupub'));
|
$publishing = RecordsRequest::fromRequest($app, $request, true, array(), array('bas_chupub'));
|
||||||
|
|
||||||
return $app['twig']->render('prod/actions/publish/publish.html.twig', array('publishing' => $publishing, 'feeds' => $feeds));
|
return $app['twig']->render('prod/actions/publish/publish.html.twig', array('publishing' => $publishing, 'feeds' => $feeds));
|
||||||
@@ -45,9 +44,8 @@ class Feed implements ControllerProviderInterface
|
|||||||
*/
|
*/
|
||||||
$controllers->post('/entry/create/', function(Application $app, Request $request) {
|
$controllers->post('/entry/create/', function(Application $app, Request $request) {
|
||||||
try {
|
try {
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
$feed = new \Feed_Adapter($app, $request->request->get('feed_id'));
|
$feed = new \Feed_Adapter($app, $request->request->get('feed_id'));
|
||||||
$publisher = \Feed_Publisher_Adapter::getPublisher($app['phraseanet.appbox'], $feed, $user);
|
$publisher = \Feed_Publisher_Adapter::getPublisher($app['phraseanet.appbox'], $feed, $app['phraseanet.user']);
|
||||||
|
|
||||||
$title = $request->request->get('title');
|
$title = $request->request->get('title');
|
||||||
$subtitle = $request->request->get('subtitle');
|
$subtitle = $request->request->get('subtitle');
|
||||||
@@ -70,16 +68,13 @@ class Feed implements ControllerProviderInterface
|
|||||||
});
|
});
|
||||||
|
|
||||||
$controllers->get('/entry/{id}/edit/', function(Application $app, Request $request, $id) {
|
$controllers->get('/entry/{id}/edit/', function(Application $app, Request $request, $id) {
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$entry = \Feed_Entry_Adapter::load_from_id($app, $id);
|
$entry = \Feed_Entry_Adapter::load_from_id($app, $id);
|
||||||
|
|
||||||
if ($entry->get_publisher()->get_user()->get_id() !== $user->get_id()) {
|
if ($entry->get_publisher()->get_user()->get_id() !== $app['phraseanet.user']->get_id()) {
|
||||||
throw new \Exception_UnauthorizedAction();
|
throw new \Exception_UnauthorizedAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
$feeds = \Feed_Collection::load_all($app, $user);
|
$feeds = \Feed_Collection::load_all($app, $app['phraseanet.user']);
|
||||||
|
|
||||||
$datas = $app['twig']->render('prod/actions/publish/publish_edit.html.twig', array('entry' => $entry, 'feeds' => $feeds));
|
$datas = $app['twig']->render('prod/actions/publish/publish_edit.html.twig', array('entry' => $entry, 'feeds' => $feeds));
|
||||||
|
|
||||||
@@ -91,11 +86,9 @@ class Feed implements ControllerProviderInterface
|
|||||||
try {
|
try {
|
||||||
$app['phraseanet.appbox']->get_connection()->beginTransaction();
|
$app['phraseanet.appbox']->get_connection()->beginTransaction();
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$entry = \Feed_Entry_Adapter::load_from_id($app, $id);
|
$entry = \Feed_Entry_Adapter::load_from_id($app, $id);
|
||||||
|
|
||||||
if ($entry->get_publisher()->get_user()->get_id() !== $user->get_id()) {
|
if ($entry->get_publisher()->get_user()->get_id() !== $app['phraseanet.user']->get_id()) {
|
||||||
throw new \Exception_UnauthorizedAction();
|
throw new \Exception_UnauthorizedAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,12 +106,12 @@ class Feed implements ControllerProviderInterface
|
|||||||
$new_feed_id = $request->request->get('feed_id', $current_feed_id);
|
$new_feed_id = $request->request->get('feed_id', $current_feed_id);
|
||||||
if ($current_feed_id != $new_feed_id) {
|
if ($current_feed_id != $new_feed_id) {
|
||||||
try {
|
try {
|
||||||
$new_feed = \Feed_Adapter::load_with_user($app, $user, $new_feed_id);
|
$new_feed = \Feed_Adapter::load_with_user($app, $app['phraseanet.user'], $new_feed_id);
|
||||||
} catch (\Exception_NotFound $e) {
|
} catch (\Exception_NotFound $e) {
|
||||||
throw new \Exception_Forbidden('You have no access to this feed');
|
throw new \Exception_Forbidden('You have no access to this feed');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$new_feed->is_publisher($user)) {
|
if (!$new_feed->is_publisher($app['phraseanet.user'])) {
|
||||||
throw new \Exception_Forbidden('You are not publisher of this feed');
|
throw new \Exception_Forbidden('You are not publisher of this feed');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,12 +157,10 @@ class Feed implements ControllerProviderInterface
|
|||||||
try {
|
try {
|
||||||
$app['phraseanet.appbox']->get_connection()->beginTransaction();
|
$app['phraseanet.appbox']->get_connection()->beginTransaction();
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$entry = \Feed_Entry_Adapter::load_from_id($app, $id);
|
$entry = \Feed_Entry_Adapter::load_from_id($app, $id);
|
||||||
|
|
||||||
if ($entry->get_publisher()->get_user()->get_id() !== $user->get_id()
|
if ($entry->get_publisher()->get_user()->get_id() !== $app['phraseanet.user']->get_id()
|
||||||
&& $entry->get_feed()->is_owner($user) === false) {
|
&& $entry->get_feed()->is_owner($app['phraseanet.user']) === false) {
|
||||||
throw new \Exception_UnauthorizedAction(_('Action Forbidden : You are not the publisher'));
|
throw new \Exception_UnauthorizedAction(_('Action Forbidden : You are not the publisher'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,9 +184,7 @@ class Feed implements ControllerProviderInterface
|
|||||||
$page = (int) $request->query->get('page');
|
$page = (int) $request->query->get('page');
|
||||||
$page = $page > 0 ? $page : 1;
|
$page = $page > 0 ? $page : 1;
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
$feeds = \Feed_Collection::load_all($app, $app['phraseanet.user']);
|
||||||
|
|
||||||
$feeds = \Feed_Collection::load_all($app, $user);
|
|
||||||
|
|
||||||
$datas = $app['twig']->render('prod/feeds/feeds.html.twig'
|
$datas = $app['twig']->render('prod/feeds/feeds.html.twig'
|
||||||
, array(
|
, array(
|
||||||
@@ -212,10 +201,8 @@ class Feed implements ControllerProviderInterface
|
|||||||
$page = (int) $request->query->get('page');
|
$page = (int) $request->query->get('page');
|
||||||
$page = $page > 0 ? $page : 1;
|
$page = $page > 0 ? $page : 1;
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
$feed = \Feed_Adapter::load_with_user($app, $app['phraseanet.user'], $id);
|
||||||
|
$feeds = \Feed_Collection::load_all($app, $app['phraseanet.user']);
|
||||||
$feed = \Feed_Adapter::load_with_user($app, $user, $id);
|
|
||||||
$feeds = \Feed_Collection::load_all($app, $user);
|
|
||||||
|
|
||||||
$datas = $app['twig']->render('prod/feeds/feeds.html.twig', array('feed' => $feed, 'feeds' => $feeds, 'page' => $page));
|
$datas = $app['twig']->render('prod/feeds/feeds.html.twig', array('feed' => $feed, 'feeds' => $feeds, 'page' => $page));
|
||||||
|
|
||||||
@@ -225,14 +212,12 @@ class Feed implements ControllerProviderInterface
|
|||||||
$controllers->get('/subscribe/aggregated/', function(Application $app, Request $request) {
|
$controllers->get('/subscribe/aggregated/', function(Application $app, Request $request) {
|
||||||
$renew = ($request->query->get('renew') === 'true');
|
$renew = ($request->query->get('renew') === 'true');
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
$feeds = \Feed_Collection::load_all($app, $app['phraseanet.user']);
|
||||||
|
|
||||||
$feeds = \Feed_Collection::load_all($app, $user);
|
|
||||||
|
|
||||||
$output = array(
|
$output = array(
|
||||||
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
|
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
|
||||||
. '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
|
. '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
|
||||||
<div><input type="text" readonly="readonly" class="input_select_copy" value="' . $feeds->get_aggregate()->get_user_link($app['phraseanet.registry'], $user, \Feed_Adapter::FORMAT_RSS, null, $renew)->get_href() . '"/></div>',
|
<div><input type="text" readonly="readonly" class="input_select_copy" value="' . $feeds->get_aggregate()->get_user_link($app['phraseanet.registry'], $app['phraseanet.user'], \Feed_Adapter::FORMAT_RSS, null, $renew)->get_href() . '"/></div>',
|
||||||
'titre' => _('publications::votre rss personnel')
|
'titre' => _('publications::votre rss personnel')
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -241,13 +226,12 @@ class Feed implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->get('/subscribe/{id}/', function(Application $app, Request $request, $id) {
|
$controllers->get('/subscribe/{id}/', function(Application $app, Request $request, $id) {
|
||||||
$renew = ($request->query->get('renew') === 'true');
|
$renew = ($request->query->get('renew') === 'true');
|
||||||
$user = $app['phraseanet.user'];
|
$feed = \Feed_Adapter::load_with_user($app, $app['phraseanet.user'], $id);
|
||||||
$feed = \Feed_Adapter::load_with_user($app, $user, $id);
|
|
||||||
|
|
||||||
$output = array(
|
$output = array(
|
||||||
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
|
'texte' => '<p>' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.')
|
||||||
. '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
|
. '</p><p>' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '</p>
|
||||||
<div><input type="text" style="width:100%" value="' . $feed->get_user_link($app['phraseanet.registry'], $user, \Feed_Adapter::FORMAT_RSS, null, $renew)->get_href() . '"/></div>',
|
<div><input type="text" style="width:100%" value="' . $feed->get_user_link($app['phraseanet.registry'], $app['phraseanet.user'], \Feed_Adapter::FORMAT_RSS, null, $renew)->get_href() . '"/></div>',
|
||||||
'titre' => _('publications::votre rss personnel')
|
'titre' => _('publications::votre rss personnel')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -169,9 +169,7 @@ class Lazaret implements ControllerProviderInterface
|
|||||||
*/
|
*/
|
||||||
public function listElement(Application $app, Request $request)
|
public function listElement(Application $app, Request $request)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
$baseIds = array_keys($app['phraseanet.user']->ACL()->get_granted_base(array('canaddrecord')));
|
||||||
/* @var $user \User_Adapter */
|
|
||||||
$baseIds = array_keys($user->ACL()->get_granted_base(array('canaddrecord')));
|
|
||||||
|
|
||||||
$lazaretFiles = null;
|
$lazaretFiles = null;
|
||||||
|
|
||||||
|
@@ -64,14 +64,12 @@ class MoveCollection implements ControllerProviderInterface
|
|||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
if (null === $request->request->get('base_id')) {
|
if (null === $request->request->get('base_id')) {
|
||||||
$datas['message'] = _('Missing target collection');
|
$datas['message'] = _('Missing target collection');
|
||||||
return $app->json($datas);
|
return $app->json($datas);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user->ACL()->has_right_on_base($request->request->get('base_id'), 'canaddrecord')) {
|
if (!$app['phraseanet.user']->ACL()->has_right_on_base($request->request->get('base_id'), 'canaddrecord')) {
|
||||||
$datas['message'] = sprintf(_("You do not have the permission to move records to %s"), \phrasea::bas_names($move->getBaseIdDestination(), $app));
|
$datas['message'] = sprintf(_("You do not have the permission to move records to %s"), \phrasea::bas_names($move->getBaseIdDestination(), $app));
|
||||||
return $app->json($datas);
|
return $app->json($datas);
|
||||||
}
|
}
|
||||||
@@ -88,7 +86,7 @@ class MoveCollection implements ControllerProviderInterface
|
|||||||
|
|
||||||
if ($request->request->get("chg_coll_son") == "1") {
|
if ($request->request->get("chg_coll_son") == "1") {
|
||||||
foreach ($record->get_children() as $child) {
|
foreach ($record->get_children() as $child) {
|
||||||
if ($user->ACL()->has_right_on_base($child->get_base_id(), 'candeleterecord')) {
|
if ($app['phraseanet.user']->ACL()->has_right_on_base($child->get_base_id(), 'candeleterecord')) {
|
||||||
$child->move_to_collection($collection, $app['phraseanet.appbox']);
|
$child->move_to_collection($collection, $app['phraseanet.appbox']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -148,12 +148,10 @@ class Push implements ControllerProviderInterface
|
|||||||
try {
|
try {
|
||||||
$pusher = new RecordHelper\Push($app, $app['request']);
|
$pusher = new RecordHelper\Push($app, $app['request']);
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$push_name = $request->request->get('name');
|
$push_name = $request->request->get('name');
|
||||||
|
|
||||||
if (trim($push_name) === '') {
|
if (trim($push_name) === '') {
|
||||||
$push_name = sprintf(_('Push from %s'), $user->get_display_name());
|
$push_name = sprintf(_('Push from %s'), $app['phraseanet.user']->get_display_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
$push_description = $request->request->get('push_description');
|
$push_description = $request->request->get('push_description');
|
||||||
@@ -181,7 +179,7 @@ class Push implements ControllerProviderInterface
|
|||||||
$Basket->setName($push_name);
|
$Basket->setName($push_name);
|
||||||
$Basket->setDescription($push_description);
|
$Basket->setDescription($push_description);
|
||||||
$Basket->setOwner($user_receiver);
|
$Basket->setOwner($user_receiver);
|
||||||
$Basket->setPusher($user);
|
$Basket->setPusher($app['phraseanet.user']);
|
||||||
$Basket->setIsRead(false);
|
$Basket->setIsRead(false);
|
||||||
|
|
||||||
$app['EM']->persist($Basket);
|
$app['EM']->persist($Basket);
|
||||||
@@ -198,13 +196,13 @@ class Push implements ControllerProviderInterface
|
|||||||
if ($receiver['HD']) {
|
if ($receiver['HD']) {
|
||||||
$user_receiver->ACL()->grant_hd_on(
|
$user_receiver->ACL()->grant_hd_on(
|
||||||
$BasketElement->getRecord($app)
|
$BasketElement->getRecord($app)
|
||||||
, $user
|
, $app['phraseanet.user']
|
||||||
, \ACL::GRANT_ACTION_PUSH
|
, \ACL::GRANT_ACTION_PUSH
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$user_receiver->ACL()->grant_preview_on(
|
$user_receiver->ACL()->grant_preview_on(
|
||||||
$BasketElement->getRecord($app)
|
$BasketElement->getRecord($app)
|
||||||
, $user
|
, $app['phraseanet.user']
|
||||||
, \ACL::GRANT_ACTION_PUSH
|
, \ACL::GRANT_ACTION_PUSH
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -217,8 +215,8 @@ class Push implements ControllerProviderInterface
|
|||||||
. \random::getUrlToken($app, \random::TYPE_VIEW, $user_receiver->get_id(), null, $Basket->getId());
|
. \random::getUrlToken($app, \random::TYPE_VIEW, $user_receiver->get_id(), null, $Basket->getId());
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'from' => $user->get_id()
|
'from' => $app['phraseanet.user']->get_id()
|
||||||
, 'from_email' => $user->get_email()
|
, 'from_email' => $app['phraseanet.user']->get_email()
|
||||||
, 'to' => $user_receiver->get_id()
|
, 'to' => $user_receiver->get_id()
|
||||||
, 'to_email' => $user_receiver->get_email()
|
, 'to_email' => $user_receiver->get_email()
|
||||||
, 'to_name' => $user_receiver->get_display_name()
|
, 'to_name' => $user_receiver->get_display_name()
|
||||||
@@ -265,7 +263,6 @@ class Push implements ControllerProviderInterface
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$pusher = new RecordHelper\Push($app, $app['request']);
|
$pusher = new RecordHelper\Push($app, $app['request']);
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$events_manager = $app['events-manager'];
|
$events_manager = $app['events-manager'];
|
||||||
|
|
||||||
@@ -274,7 +271,7 @@ class Push implements ControllerProviderInterface
|
|||||||
$validation_name = $request->request->get('name');
|
$validation_name = $request->request->get('name');
|
||||||
|
|
||||||
if (trim($validation_name) === '') {
|
if (trim($validation_name) === '') {
|
||||||
$validation_name = sprintf(_('Validation from %s'), $user->get_display_name());
|
$validation_name = sprintf(_('Validation from %s'), $app['phraseanet.user']->get_display_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
$validation_description = $request->request->get('validation_description');
|
$validation_description = $request->request->get('validation_description');
|
||||||
@@ -295,7 +292,7 @@ class Push implements ControllerProviderInterface
|
|||||||
$Basket = new \Entities\Basket();
|
$Basket = new \Entities\Basket();
|
||||||
$Basket->setName($validation_name);
|
$Basket->setName($validation_name);
|
||||||
$Basket->setDescription($validation_description);
|
$Basket->setDescription($validation_description);
|
||||||
$Basket->setOwner($user);
|
$Basket->setOwner($app['phraseanet.user']);
|
||||||
$Basket->setIsRead(false);
|
$Basket->setIsRead(false);
|
||||||
|
|
||||||
$app['EM']->persist($Basket);
|
$app['EM']->persist($Basket);
|
||||||
@@ -334,16 +331,16 @@ class Push implements ControllerProviderInterface
|
|||||||
|
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($participants as $key => $participant) {
|
foreach ($participants as $key => $participant) {
|
||||||
if ($participant['usr_id'] == $user->get_id()) {
|
if ($participant['usr_id'] == $app['phraseanet.user']->get_id()) {
|
||||||
$found = true;
|
$found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$found) {
|
if (!$found) {
|
||||||
$participants[$user->get_id()] = array(
|
$participants[$app['phraseanet.user']->get_id()] = array(
|
||||||
'see_others' => 1,
|
'see_others' => 1,
|
||||||
'usr_id' => $user->get_id(),
|
'usr_id' => $app['phraseanet.user']->get_id(),
|
||||||
'agree' => 0,
|
'agree' => 0,
|
||||||
'HD' => 0
|
'HD' => 0
|
||||||
);
|
);
|
||||||
@@ -386,13 +383,13 @@ class Push implements ControllerProviderInterface
|
|||||||
if ($participant['HD']) {
|
if ($participant['HD']) {
|
||||||
$participant_user->ACL()->grant_hd_on(
|
$participant_user->ACL()->grant_hd_on(
|
||||||
$BasketElement->getRecord($app)
|
$BasketElement->getRecord($app)
|
||||||
, $user
|
, $app['phraseanet.user']
|
||||||
, \ACL::GRANT_ACTION_VALIDATE
|
, \ACL::GRANT_ACTION_VALIDATE
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$participant_user->ACL()->grant_preview_on(
|
$participant_user->ACL()->grant_preview_on(
|
||||||
$BasketElement->getRecord($app)
|
$BasketElement->getRecord($app)
|
||||||
, $user
|
, $app['phraseanet.user']
|
||||||
, \ACL::GRANT_ACTION_VALIDATE
|
, \ACL::GRANT_ACTION_VALIDATE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -415,8 +412,8 @@ class Push implements ControllerProviderInterface
|
|||||||
. \random::getUrlToken($app, \random::TYPE_VIEW, $participant_user->get_id(), null, $Basket->getId());
|
. \random::getUrlToken($app, \random::TYPE_VIEW, $participant_user->get_id(), null, $Basket->getId());
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'from' => $user->get_id()
|
'from' => $app['phraseanet.user']->get_id()
|
||||||
, 'from_email' => $user->get_email()
|
, 'from_email' => $app['phraseanet.user']->get_email()
|
||||||
, 'to' => $participant_user->get_id()
|
, 'to' => $participant_user->get_id()
|
||||||
, 'to_email' => $participant_user->get_email()
|
, 'to_email' => $participant_user->get_email()
|
||||||
, 'to_name' => $participant_user->get_display_name()
|
, 'to_name' => $participant_user->get_display_name()
|
||||||
@@ -458,11 +455,10 @@ class Push implements ControllerProviderInterface
|
|||||||
$datas = null;
|
$datas = null;
|
||||||
|
|
||||||
$request = $app['request'];
|
$request = $app['request'];
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$query = new \User_Query($app);
|
$query = new \User_Query($app);
|
||||||
|
|
||||||
$query->on_bases_where_i_am($user->ACL(), array('canpush'));
|
$query->on_bases_where_i_am($app['phraseanet.user']->ACL(), array('canpush'));
|
||||||
|
|
||||||
$query->in(array($usr_id));
|
$query->in(array($usr_id));
|
||||||
|
|
||||||
@@ -482,11 +478,9 @@ class Push implements ControllerProviderInterface
|
|||||||
$controllers->get('/list/{list_id}/', function(Application $app, $list_id) use ($listFormatter) {
|
$controllers->get('/list/{list_id}/', function(Application $app, $list_id) use ($listFormatter) {
|
||||||
$datas = null;
|
$datas = null;
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($app, $user, $list_id);
|
$list = $repository->findUserListByUserAndId($app, $app['phraseanet.user'], $list_id);
|
||||||
|
|
||||||
if ($list) {
|
if ($list) {
|
||||||
$datas = $listFormatter($list);
|
$datas = $listFormatter($list);
|
||||||
@@ -498,11 +492,8 @@ class Push implements ControllerProviderInterface
|
|||||||
$controllers->post('/add-user/', function(Application $app, Request $request) use ($userFormatter) {
|
$controllers->post('/add-user/', function(Application $app, Request $request) use ($userFormatter) {
|
||||||
$result = array('success' => false, 'message' => '', 'user' => null);
|
$result = array('success' => false, 'message' => '', 'user' => null);
|
||||||
|
|
||||||
$AdminUser = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/* @var $AdminUser \User_Adapter */
|
if (!$app['phraseanet.user']->ACL()->has_right('manageusers'))
|
||||||
if (!$AdminUser->ACL()->has_right('manageusers'))
|
|
||||||
throw new ControllerException(_('You are not allowed to add users'));
|
throw new ControllerException(_('You are not allowed to add users'));
|
||||||
|
|
||||||
if (!$request->request->get('firstname'))
|
if (!$request->request->get('firstname'))
|
||||||
@@ -571,11 +562,10 @@ class Push implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->get('/search-user/', function(Application $app) use ($userFormatter, $listFormatter) {
|
$controllers->get('/search-user/', function(Application $app) use ($userFormatter, $listFormatter) {
|
||||||
$request = $app['request'];
|
$request = $app['request'];
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$query = new \User_Query($app);
|
$query = new \User_Query($app);
|
||||||
|
|
||||||
$query->on_bases_where_i_am($user->ACL(), array('canpush'));
|
$query->on_bases_where_i_am($app['phraseanet.user']->ACL(), array('canpush'));
|
||||||
|
|
||||||
$query->like(\User_Query::LIKE_FIRSTNAME, $request->query->get('query'))
|
$query->like(\User_Query::LIKE_FIRSTNAME, $request->query->get('query'))
|
||||||
->like(\User_Query::LIKE_LASTNAME, $request->query->get('query'))
|
->like(\User_Query::LIKE_LASTNAME, $request->query->get('query'))
|
||||||
@@ -588,7 +578,7 @@ class Push implements ControllerProviderInterface
|
|||||||
|
|
||||||
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$lists = $repository->findUserListLike($user, $request->query->get('query'));
|
$lists = $repository->findUserListLike($app['phraseanet.user'], $request->query->get('query'));
|
||||||
|
|
||||||
$datas = array();
|
$datas = array();
|
||||||
|
|
||||||
@@ -609,15 +599,13 @@ class Push implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->match('/edit-list/{list_id}/', function(Application $app, Request $request, $list_id) {
|
$controllers->match('/edit-list/{list_id}/', function(Application $app, Request $request, $list_id) {
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($app, $user, $list_id);
|
$list = $repository->findUserListByUserAndId($app, $app['phraseanet.user'], $list_id);
|
||||||
|
|
||||||
$query = new \User_Query($app);
|
$query = new \User_Query($app);
|
||||||
|
|
||||||
$query->on_bases_where_i_am($user->ACL(), array('canpush'));
|
$query->on_bases_where_i_am($app['phraseanet.user']->ACL(), array('canpush'));
|
||||||
|
|
||||||
if ($request->get('query')) {
|
if ($request->get('query')) {
|
||||||
$query->like($request->get('like_field'), $request->get('query'))
|
$query->like($request->get('like_field'), $request->get('query'))
|
||||||
|
@@ -36,12 +36,9 @@ class Query implements ControllerProviderInterface
|
|||||||
});
|
});
|
||||||
|
|
||||||
$controllers->post('/', function(Application $app, Request $request) {
|
$controllers->post('/', function(Application $app, Request $request) {
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$query = (string) $request->request->get('qry');
|
$query = (string) $request->request->get('qry');
|
||||||
|
|
||||||
$mod = $user->getPrefs('view');
|
$mod = $app['phraseanet.user']->getPrefs('view');
|
||||||
|
|
||||||
$json = array();
|
$json = array();
|
||||||
|
|
||||||
@@ -49,13 +46,12 @@ class Query implements ControllerProviderInterface
|
|||||||
|
|
||||||
$bas = is_array($request->request->get('bas')) ? $request->request->get('bas') : array_keys($user->ACL()->get_granted_base());
|
$bas = is_array($request->request->get('bas')) ? $request->request->get('bas') : array_keys($user->ACL()->get_granted_base());
|
||||||
|
|
||||||
/* @var $user \User_Adapter */
|
if ($app['phraseanet.user']->ACL()->has_right('modifyrecord')) {
|
||||||
if ($user->ACL()->has_right('modifyrecord')) {
|
|
||||||
$options->set_business_fields(array());
|
$options->set_business_fields(array());
|
||||||
|
|
||||||
$BF = array();
|
$BF = array();
|
||||||
|
|
||||||
foreach ($user->ACL()->get_granted_base(array('canmodifrecord')) as $collection) {
|
foreach ($app['phraseanet.user']->ACL()->get_granted_base(array('canmodifrecord')) as $collection) {
|
||||||
if (count($bas) === 0 || in_array($collection->get_base_id(), $bas)) {
|
if (count($bas) === 0 || in_array($collection->get_base_id(), $bas)) {
|
||||||
$BF[] = $collection->get_base_id();
|
$BF[] = $collection->get_base_id();
|
||||||
}
|
}
|
||||||
@@ -70,7 +66,7 @@ class Query implements ControllerProviderInterface
|
|||||||
|
|
||||||
$options->set_fields($fields);
|
$options->set_fields($fields);
|
||||||
$options->set_status($status);
|
$options->set_status($status);
|
||||||
$options->set_bases($bas, $user->ACL());
|
$options->set_bases($bas, $app['phraseanet.user']->ACL());
|
||||||
|
|
||||||
$options->set_search_type($request->request->get('search_type'));
|
$options->set_search_type($request->request->get('search_type'));
|
||||||
$options->set_record_type($request->request->get('recordtype'));
|
$options->set_record_type($request->request->get('recordtype'));
|
||||||
@@ -82,7 +78,7 @@ class Query implements ControllerProviderInterface
|
|||||||
|
|
||||||
$form = serialize($options);
|
$form = serialize($options);
|
||||||
|
|
||||||
$perPage = (int) $user->getPrefs('images_per_page');
|
$perPage = (int) $app['phraseanet.user']->getPrefs('images_per_page');
|
||||||
|
|
||||||
$search_engine = new \searchEngine_adapter($app);
|
$search_engine = new \searchEngine_adapter($app);
|
||||||
$search_engine->set_options($options);
|
$search_engine->set_options($options);
|
||||||
|
@@ -42,7 +42,6 @@ class Root implements ControllerProviderInterface
|
|||||||
|
|
||||||
\User_Adapter::updateClientInfos($app, 1);
|
\User_Adapter::updateClientInfos($app, 1);
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
$cssPath = $app['phraseanet.registry']->get('GV_RootPath') . 'www/skins/prod/';
|
$cssPath = $app['phraseanet.registry']->get('GV_RootPath') . 'www/skins/prod/';
|
||||||
|
|
||||||
$css = array();
|
$css = array();
|
||||||
@@ -63,13 +62,13 @@ class Root implements ControllerProviderInterface
|
|||||||
$css[$baseName] = $baseName;
|
$css[$baseName] = $baseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cssfile = $user->getPrefs('css');
|
$cssfile = $app['phraseanet.user']->getPrefs('css');
|
||||||
|
|
||||||
if (!$cssfile && isset($css['000000'])) {
|
if (!$cssfile && isset($css['000000'])) {
|
||||||
$cssfile = '000000';
|
$cssfile = '000000';
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_feeds = \Feed_Collection::load_all($app, $user);
|
$user_feeds = \Feed_Collection::load_all($app, $app['phraseanet.user']);
|
||||||
$feeds = array_merge(array($user_feeds->get_aggregate()), $user_feeds->get_feeds());
|
$feeds = array_merge(array($user_feeds->get_aggregate()), $user_feeds->get_feeds());
|
||||||
|
|
||||||
$thjslist = "";
|
$thjslist = "";
|
||||||
|
@@ -35,11 +35,9 @@ class Story implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->post('/', function(Application $app, Request $request) {
|
$controllers->post('/', function(Application $app, Request $request) {
|
||||||
/* @var $request \Symfony\Component\HttpFoundation\Request */
|
/* @var $request \Symfony\Component\HttpFoundation\Request */
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$collection = \collection::get_from_base_id($app, $request->request->get('base_id'));
|
$collection = \collection::get_from_base_id($app, $request->request->get('base_id'));
|
||||||
|
|
||||||
if (!$user->ACL()->has_right_on_base($collection->get_base_id(), 'canaddrecord')) {
|
if (!$app['phraseanet.user']->ACL()->has_right_on_base($collection->get_base_id(), 'canaddrecord')) {
|
||||||
throw new \Exception_Forbidden('You can not create a story on this collection');
|
throw new \Exception_Forbidden('You can not create a story on this collection');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,9 +52,9 @@ class Story implements ControllerProviderInterface
|
|||||||
|
|
||||||
$record = new \record_adapter($app, $sbas_rec[0], $sbas_rec[1]);
|
$record = new \record_adapter($app, $sbas_rec[0], $sbas_rec[1]);
|
||||||
|
|
||||||
if (!$user->ACL()->has_access_to_base($record->get_base_id())
|
if (!$app['phraseanet.user']->ACL()->has_access_to_base($record->get_base_id())
|
||||||
&& !$user->ACL()->has_hd_grant($record)
|
&& !$app['phraseanet.user']->ACL()->has_hd_grant($record)
|
||||||
&& !$user->ACL()->has_preview_grant($record)) {
|
&& !$app['phraseanet.user']->ACL()->has_preview_grant($record)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +85,7 @@ class Story implements ControllerProviderInterface
|
|||||||
$Story->set_metadatas($metadatas)->rebuild_subdefs();
|
$Story->set_metadatas($metadatas)->rebuild_subdefs();
|
||||||
|
|
||||||
$StoryWZ = new \Entities\StoryWZ();
|
$StoryWZ = new \Entities\StoryWZ();
|
||||||
$StoryWZ->setUser($user);
|
$StoryWZ->setUser($app['phraseanet.user']);
|
||||||
$StoryWZ->setRecord($Story);
|
$StoryWZ->setRecord($Story);
|
||||||
|
|
||||||
$app['EM']->persist($StoryWZ);
|
$app['EM']->persist($StoryWZ);
|
||||||
@@ -122,13 +120,9 @@ class Story implements ControllerProviderInterface
|
|||||||
$controllers->post('/{sbas_id}/{record_id}/addElements/', function(Application $app, Request $request, $sbas_id, $record_id) {
|
$controllers->post('/{sbas_id}/{record_id}/addElements/', function(Application $app, Request $request, $sbas_id, $record_id) {
|
||||||
$Story = new \record_adapter($app, $sbas_id, $record_id);
|
$Story = new \record_adapter($app, $sbas_id, $record_id);
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
if (!$app['phraseanet.user']->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord'))
|
||||||
|
|
||||||
if (!$user->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord'))
|
|
||||||
throw new \Exception_Forbidden('You can not add document to this Story');
|
throw new \Exception_Forbidden('You can not add document to this Story');
|
||||||
|
|
||||||
/* @var $user \User_Adapter */
|
|
||||||
|
|
||||||
$n = 0;
|
$n = 0;
|
||||||
|
|
||||||
foreach (explode(';', $request->request->get('lst')) as $sbas_rec) {
|
foreach (explode(';', $request->request->get('lst')) as $sbas_rec) {
|
||||||
@@ -139,9 +133,9 @@ class Story implements ControllerProviderInterface
|
|||||||
|
|
||||||
$record = new \record_adapter($app, $sbas_rec[0], $sbas_rec[1]);
|
$record = new \record_adapter($app, $sbas_rec[0], $sbas_rec[1]);
|
||||||
|
|
||||||
if (!$user->ACL()->has_access_to_base($record->get_base_id())
|
if (!$app['phraseanet.user']->ACL()->has_access_to_base($record->get_base_id())
|
||||||
&& !$user->ACL()->has_hd_grant($record)
|
&& !$app['phraseanet.user']->ACL()->has_hd_grant($record)
|
||||||
&& !$user->ACL()->has_preview_grant($record)) {
|
&& !$app['phraseanet.user']->ACL()->has_preview_grant($record)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,13 +164,9 @@ class Story implements ControllerProviderInterface
|
|||||||
|
|
||||||
$record = new \record_adapter($app, $child_sbas_id, $child_record_id);
|
$record = new \record_adapter($app, $child_sbas_id, $child_record_id);
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
if (!$app['phraseanet.user']->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord'))
|
||||||
|
|
||||||
if (!$user->ACL()->has_right_on_base($Story->get_base_id(), 'canmodifrecord'))
|
|
||||||
throw new \Exception_Forbidden('You can not add document to this Story');
|
throw new \Exception_Forbidden('You can not add document to this Story');
|
||||||
|
|
||||||
/* @var $user \User_Adapter */
|
|
||||||
|
|
||||||
$Story->removeChild($record);
|
$Story->removeChild($record);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
@@ -218,8 +208,6 @@ class Story implements ControllerProviderInterface
|
|||||||
$controllers->post('/{sbas_id}/{record_id}/reorder/', function(Application $app, $sbas_id, $record_id) {
|
$controllers->post('/{sbas_id}/{record_id}/reorder/', function(Application $app, $sbas_id, $record_id) {
|
||||||
$ret = array('success' => false, 'message' => _('An error occured'));
|
$ret = array('success' => false, 'message' => _('An error occured'));
|
||||||
try {
|
try {
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
/* @var $user \User_Adapter */
|
|
||||||
|
|
||||||
$story = new \record_adapter($app, $sbas_id, $record_id);
|
$story = new \record_adapter($app, $sbas_id, $record_id);
|
||||||
|
|
||||||
@@ -227,7 +215,7 @@ class Story implements ControllerProviderInterface
|
|||||||
throw new \Exception('This is not a story');
|
throw new \Exception('This is not a story');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user->ACL()->has_right_on_base($story->get_base_id(), 'canmodifrecord')) {
|
if (!$app['phraseanet.user']->ACL()->has_right_on_base($story->get_base_id(), 'canmodifrecord')) {
|
||||||
throw new ControllerException(_('You can not edit this story'));
|
throw new ControllerException(_('You can not edit this story'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,14 +31,12 @@ class TOU implements ControllerProviderInterface
|
|||||||
$ret = array('success' => false, 'message' => '');
|
$ret = array('success' => false, 'message' => '');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||||
|
|
||||||
$user->ACL()->revoke_access_from_bases(
|
$app['phraseanet.user']->ACL()->revoke_access_from_bases(
|
||||||
$user->ACL()->get_granted_base(array(), array($databox->get_sbas_id()))
|
$app['phraseanet.user']->ACL()->get_granted_base(array(), array($databox->get_sbas_id()))
|
||||||
);
|
);
|
||||||
$user->ACL()->revoke_unused_sbas_rights();
|
$app['phraseanet.user']->ACL()->revoke_unused_sbas_rights();
|
||||||
|
|
||||||
$app->closeAccount();
|
$app->closeAccount();
|
||||||
|
|
||||||
|
@@ -45,9 +45,7 @@ class UserPreferences implements ControllerProviderInterface
|
|||||||
$ret = array('success' => false, 'message' => _('Error while saving preference'));
|
$ret = array('success' => false, 'message' => _('Error while saving preference'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user = $app['phraseanet.user'];
|
$ret = $app['phraseanet.user']->setPrefs($request->request->get('prop'), $request->request->get('value'));
|
||||||
|
|
||||||
$ret = $user->setPrefs($request->request->get('prop'), $request->request->get('value'));
|
|
||||||
|
|
||||||
if ($ret == $request->request->get('value'))
|
if ($ret == $request->request->get('value'))
|
||||||
$output = "1"; else
|
$output = "1"; else
|
||||||
|
@@ -216,11 +216,9 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
|
|
||||||
public function displayList(Application $app, Request $request, $list_id)
|
public function displayList(Application $app, Request $request, $list_id)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($app, $user, $list_id);
|
$list = $repository->findUserListByUserAndId($app, $app['phraseanet.user'], $list_id);
|
||||||
|
|
||||||
$entries = new ArrayCollection();
|
$entries = new ArrayCollection();
|
||||||
$owners = new ArrayCollection();
|
$owners = new ArrayCollection();
|
||||||
@@ -276,13 +274,11 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
throw new ControllerException(_('List name is required'));
|
throw new ControllerException(_('List name is required'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($app, $user, $list_id);
|
$list = $repository->findUserListByUserAndId($app, $app['phraseanet.user'], $list_id);
|
||||||
|
|
||||||
if ($list->getOwner($user, $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
|
if ($list->getOwner($app['phraseanet.user'], $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
|
||||||
throw new ControllerException(_('You are not authorized to do this'));
|
throw new ControllerException(_('You are not authorized to do this'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,11 +307,9 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
try {
|
try {
|
||||||
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
$list = $repository->findUserListByUserAndId($app, $app['phraseanet.user'], $list_id);
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($app, $user, $list_id);
|
if ($list->getOwner($app['phraseanet.user'], $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
|
||||||
|
|
||||||
if ($list->getOwner($user, $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
|
|
||||||
throw new ControllerException(_('You are not authorized to do this'));
|
throw new ControllerException(_('You are not authorized to do this'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,12 +341,10 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
try {
|
try {
|
||||||
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
$list = $repository->findUserListByUserAndId($app, $app['phraseanet.user'], $list_id);
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($app, $user, $list_id);
|
|
||||||
/* @var $list \Entities\UsrList */
|
/* @var $list \Entities\UsrList */
|
||||||
|
|
||||||
if ($list->getOwner($user, $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
|
if ($list->getOwner($app['phraseanet.user'], $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
|
||||||
throw new ControllerException(_('You are not authorized to do this'));
|
throw new ControllerException(_('You are not authorized to do this'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,8 +377,6 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
|
|
||||||
public function addUsers(Application $app, Request $request, $list_id)
|
public function addUsers(Application $app, Request $request, $list_id)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!is_array($request->request->get('usr_ids'))) {
|
if (!is_array($request->request->get('usr_ids'))) {
|
||||||
throw new ControllerException('Invalid or missing parameter usr_ids');
|
throw new ControllerException('Invalid or missing parameter usr_ids');
|
||||||
@@ -394,10 +384,10 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
|
|
||||||
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($app, $user, $list_id);
|
$list = $repository->findUserListByUserAndId($app, $app['phraseanet.user'], $list_id);
|
||||||
/* @var $list \Entities\UsrList */
|
/* @var $list \Entities\UsrList */
|
||||||
|
|
||||||
if ($list->getOwner($user, $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
|
if ($list->getOwner($app['phraseanet.user'], $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
|
||||||
throw new ControllerException(_('You are not authorized to do this'));
|
throw new ControllerException(_('You are not authorized to do this'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,17 +443,15 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
|
|
||||||
public function displayShares(Application $app, Request $request, $list_id)
|
public function displayShares(Application $app, Request $request, $list_id)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$list = null;
|
$list = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($app, $user, $list_id);
|
$list = $repository->findUserListByUserAndId($app, $app['phraseanet.user'], $list_id);
|
||||||
/* @var $list \Entities\UsrList */
|
/* @var $list \Entities\UsrList */
|
||||||
|
|
||||||
if ($list->getOwner($user, $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
|
if ($list->getOwner($app['phraseanet.user'], $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
|
||||||
$list = null;
|
$list = null;
|
||||||
throw new \Exception(_('You are not authorized to do this'));
|
throw new \Exception(_('You are not authorized to do this'));
|
||||||
}
|
}
|
||||||
@@ -476,8 +464,6 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
|
|
||||||
public function shareWithUser(Application $app, $list_id, $usr_id)
|
public function shareWithUser(Application $app, $list_id, $usr_id)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$availableRoles = array(
|
$availableRoles = array(
|
||||||
UsrListOwner::ROLE_USER,
|
UsrListOwner::ROLE_USER,
|
||||||
UsrListOwner::ROLE_EDITOR,
|
UsrListOwner::ROLE_EDITOR,
|
||||||
@@ -492,17 +478,17 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
try {
|
try {
|
||||||
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($app, $user, $list_id);
|
$list = $repository->findUserListByUserAndId($app, $app['phraseanet.user'], $list_id);
|
||||||
/* @var $list \Entities\UsrList */
|
/* @var $list \Entities\UsrList */
|
||||||
|
|
||||||
if ($list->getOwner($user, $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
|
if ($list->getOwner($app['phraseanet.user'], $app)->getRole() < UsrListOwner::ROLE_EDITOR) {
|
||||||
throw new ControllerException(_('You are not authorized to do this'));
|
throw new ControllerException(_('You are not authorized to do this'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_owner = \User_Adapter::getInstance($usr_id, $app);
|
$new_owner = \User_Adapter::getInstance($usr_id, $app);
|
||||||
|
|
||||||
if ($list->hasAccess($new_owner, $app)) {
|
if ($list->hasAccess($new_owner, $app)) {
|
||||||
if ($new_owner->get_id() == $user->get_id()) {
|
if ($new_owner->get_id() == $app['phraseanet.user']->get_id()) {
|
||||||
throw new ControllerException('You can not downgrade your Admin right');
|
throw new ControllerException('You can not downgrade your Admin right');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,15 +531,13 @@ class UsrLists implements ControllerProviderInterface
|
|||||||
|
|
||||||
public function unshareWithUser(Application $app, $list_id, $usr_id)
|
public function unshareWithUser(Application $app, $list_id, $usr_id)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
$repository = $app['EM']->getRepository('\Entities\UsrList');
|
||||||
|
|
||||||
$list = $repository->findUserListByUserAndId($app, $user, $list_id);
|
$list = $repository->findUserListByUserAndId($app, $app['phraseanet.user'], $list_id);
|
||||||
/* @var $list \Entities\UsrList */
|
/* @var $list \Entities\UsrList */
|
||||||
|
|
||||||
if ($list->getOwner($user, $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
|
if ($list->getOwner($app['phraseanet.user'], $app)->getRole() < UsrListOwner::ROLE_ADMIN) {
|
||||||
throw new \Exception(_('You are not authorized to do this'));
|
throw new \Exception(_('You are not authorized to do this'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -74,8 +74,6 @@ class WorkZone implements ControllerProviderInterface
|
|||||||
|
|
||||||
public function browserSearch(Application $app)
|
public function browserSearch(Application $app)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$request = $app['request'];
|
$request = $app['request'];
|
||||||
|
|
||||||
$BasketRepo = $app['EM']->getRepository('\Entities\Basket');
|
$BasketRepo = $app['EM']->getRepository('\Entities\Basket');
|
||||||
@@ -86,7 +84,7 @@ class WorkZone implements ControllerProviderInterface
|
|||||||
$offsetStart = max(($Page - 1) * $PerPage, 0);
|
$offsetStart = max(($Page - 1) * $PerPage, 0);
|
||||||
|
|
||||||
$Baskets = $BasketRepo->findWorkzoneBasket(
|
$Baskets = $BasketRepo->findWorkzoneBasket(
|
||||||
$user
|
$app['phraseanet.user']
|
||||||
, $request->query->get('Query')
|
, $request->query->get('Query')
|
||||||
, $request->query->get('Year')
|
, $request->query->get('Year')
|
||||||
, $request->query->get('Type')
|
, $request->query->get('Type')
|
||||||
@@ -125,8 +123,6 @@ class WorkZone implements ControllerProviderInterface
|
|||||||
throw new \Exception_BadRequest();
|
throw new \Exception_BadRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$StoryWZRepo = $app['EM']->getRepository('\Entities\StoryWZ');
|
$StoryWZRepo = $app['EM']->getRepository('\Entities\StoryWZ');
|
||||||
|
|
||||||
$alreadyFixed = $done = 0;
|
$alreadyFixed = $done = 0;
|
||||||
@@ -141,17 +137,17 @@ class WorkZone implements ControllerProviderInterface
|
|||||||
throw new \Exception('You can only attach stories');
|
throw new \Exception('You can only attach stories');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user->ACL()->has_access_to_base($Story->get_base_id())) {
|
if (!$app['phraseanet.user']->ACL()->has_access_to_base($Story->get_base_id())) {
|
||||||
throw new \Exception_Forbidden('You do not have access to this Story');
|
throw new \Exception_Forbidden('You do not have access to this Story');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($StoryWZRepo->findUserStory($app, $user, $Story)) {
|
if ($StoryWZRepo->findUserStory($app, $app['phraseanet.user'], $Story)) {
|
||||||
$alreadyFixed++;
|
$alreadyFixed++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$StoryWZ = new StoryWZ();
|
$StoryWZ = new StoryWZ();
|
||||||
$StoryWZ->setUser($user);
|
$StoryWZ->setUser($app['phraseanet.user']);
|
||||||
$StoryWZ->setRecord($Story);
|
$StoryWZ->setRecord($Story);
|
||||||
|
|
||||||
$app['EM']->persist($StoryWZ);
|
$app['EM']->persist($StoryWZ);
|
||||||
@@ -202,12 +198,10 @@ class WorkZone implements ControllerProviderInterface
|
|||||||
{
|
{
|
||||||
$Story = new \record_adapter($app, $sbas_id, $record_id);
|
$Story = new \record_adapter($app, $sbas_id, $record_id);
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$repository = $app['EM']->getRepository('\Entities\StoryWZ');
|
$repository = $app['EM']->getRepository('\Entities\StoryWZ');
|
||||||
|
|
||||||
/* @var $repository \Repositories\StoryWZRepository */
|
/* @var $repository \Repositories\StoryWZRepository */
|
||||||
$StoryWZ = $repository->findUserStory($app, $user, $Story);
|
$StoryWZ = $repository->findUserStory($app, $app['phraseanet.user'], $Story);
|
||||||
|
|
||||||
if (!$StoryWZ) {
|
if (!$StoryWZ) {
|
||||||
throw new \Exception_NotFound('Story not found');
|
throw new \Exception_NotFound('Story not found');
|
||||||
|
@@ -233,24 +233,22 @@ class RecordsRequest extends ArrayCollection
|
|||||||
|
|
||||||
$to_remove = array();
|
$to_remove = array();
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
foreach ($elements as $id => $record) {
|
foreach ($elements as $id => $record) {
|
||||||
|
|
||||||
if (!$user->ACL()->has_access_to_record($record)) {
|
if (!$app['phraseanet.user']->ACL()->has_access_to_record($record)) {
|
||||||
$to_remove[] = $id;
|
$to_remove[] = $id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($rightsColl as $right) {
|
foreach ($rightsColl as $right) {
|
||||||
if (!$user->ACL()->has_right_on_base($record->get_base_id(), $right)) {
|
if (!$app['phraseanet.user']->ACL()->has_right_on_base($record->get_base_id(), $right)) {
|
||||||
$to_remove[] = $id;
|
$to_remove[] = $id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($rightsDatabox as $right) {
|
foreach ($rightsDatabox as $right) {
|
||||||
if (!$user->ACL()->has_right_on_sbas($record->get_sbas_id(), $right)) {
|
if (!$app['phraseanet.user']->ACL()->has_right_on_sbas($record->get_sbas_id(), $right)) {
|
||||||
$to_remove[] = $id;
|
$to_remove[] = $id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@@ -283,10 +283,8 @@ class Account implements ControllerProviderInterface
|
|||||||
$app->abort(400, _('Could not perform request, please contact an administrator.'));
|
$app->abort(400, _('Could not perform request, please contact an administrator.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$auth = new \Session_Authentication_Native($app, $user->get_login(), $password);
|
$auth = new \Session_Authentication_Native($app, $app['phraseanet.user']->get_login(), $password);
|
||||||
$auth->challenge_password();
|
$auth->challenge_password();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $app->redirect('/account/reset-email/?notice=bad-password');
|
return $app->redirect('/account/reset-email/?notice=bad-password');
|
||||||
@@ -299,7 +297,7 @@ class Account implements ControllerProviderInterface
|
|||||||
return $app->redirect('/account/reset-email/?notice=mail-match');
|
return $app->redirect('/account/reset-email/?notice=mail-match');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\mail::reset_email($app, $email, $user->get_id()) === true) {
|
if (!\mail::reset_email($app, $email, $app['phraseanet.user']->get_id()) === true) {
|
||||||
return $app->redirect('/account/reset-email/?notice=mail-server');
|
return $app->redirect('/account/reset-email/?notice=mail-server');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,12 +369,10 @@ class Account implements ControllerProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user = $app['phraseanet.user'];
|
$auth = new \Session_Authentication_Native($app, $app['phraseanet.user']->get_login(), $request->request->get('form_old_password', ''));
|
||||||
|
|
||||||
$auth = new \Session_Authentication_Native($app, $user->get_login(), $request->request->get('form_old_password', ''));
|
|
||||||
$auth->challenge_password();
|
$auth->challenge_password();
|
||||||
|
|
||||||
$user->set_password($passwordConfirm);
|
$app['phraseanet.user']->set_password($passwordConfirm);
|
||||||
|
|
||||||
return $app->redirect('/account/?notice=pass-ok');
|
return $app->redirect('/account/?notice=pass-ok');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -474,7 +470,6 @@ class Account implements ControllerProviderInterface
|
|||||||
*/
|
*/
|
||||||
public function displayAccount(Application $app, Request $request)
|
public function displayAccount(Application $app, Request $request)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
$evtMngr = $app['events-manager'];
|
$evtMngr = $app['events-manager'];
|
||||||
|
|
||||||
switch ($notice = $request->query->get('notice', '')) {
|
switch ($notice = $request->query->get('notice', '')) {
|
||||||
@@ -496,10 +491,10 @@ class Account implements ControllerProviderInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $app['twig']->render('account/account.html.twig', array(
|
return $app['twig']->render('account/account.html.twig', array(
|
||||||
'user' => $user,
|
'user' => $app['phraseanet.user'],
|
||||||
'notice' => $notice,
|
'notice' => $notice,
|
||||||
'evt_mngr' => $evtMngr,
|
'evt_mngr' => $evtMngr,
|
||||||
'notifications' => $evtMngr->list_notifications_available($user->get_id()),
|
'notifications' => $evtMngr->list_notifications_available($app['phraseanet.user']->get_id()),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,7 +507,6 @@ class Account implements ControllerProviderInterface
|
|||||||
*/
|
*/
|
||||||
public function updateAccount(Application $app, Request $request)
|
public function updateAccount(Application $app, Request $request)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
$evtMngr = $app['events-manager'];
|
$evtMngr = $app['events-manager'];
|
||||||
$notice = 'account-update-bad';
|
$notice = 'account-update-bad';
|
||||||
|
|
||||||
@@ -523,7 +517,7 @@ class Account implements ControllerProviderInterface
|
|||||||
|
|
||||||
foreach ($demands as $baseId) {
|
foreach ($demands as $baseId) {
|
||||||
try {
|
try {
|
||||||
$register->add_request($user, \collection::get_from_base_id($app, $baseId));
|
$register->add_request($app['phraseanet.user'], \collection::get_from_base_id($app, $baseId));
|
||||||
$notice = 'demand-ok';
|
$notice = 'demand-ok';
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
@@ -570,7 +564,7 @@ class Account implements ControllerProviderInterface
|
|||||||
try {
|
try {
|
||||||
$app['phraseanet.appbox']->get_connection()->beginTransaction();
|
$app['phraseanet.appbox']->get_connection()->beginTransaction();
|
||||||
|
|
||||||
$user->set_gender($request->request->get("form_gender"))
|
$app['phraseanet.user']->set_gender($request->request->get("form_gender"))
|
||||||
->set_firstname($request->request->get("form_firstname"))
|
->set_firstname($request->request->get("form_firstname"))
|
||||||
->set_lastname($request->request->get("form_lastname"))
|
->set_lastname($request->request->get("form_lastname"))
|
||||||
->set_address($request->request->get("form_address"))
|
->set_address($request->request->get("form_address"))
|
||||||
@@ -601,15 +595,15 @@ class Account implements ControllerProviderInterface
|
|||||||
|
|
||||||
$requestedNotifications = (array) $request->request->get('notifications', array());
|
$requestedNotifications = (array) $request->request->get('notifications', array());
|
||||||
|
|
||||||
foreach ($evtMngr->list_notifications_available($user->get_id()) as $notifications) {
|
foreach ($evtMngr->list_notifications_available($app['phraseanet.user']->get_id()) as $notifications) {
|
||||||
foreach ($notifications as $notification) {
|
foreach ($notifications as $notification) {
|
||||||
$notifId = $notification['id'];
|
$notifId = $notification['id'];
|
||||||
$notifName = sprintf('notification_%d', $notifId);
|
$notifName = sprintf('notification_%d', $notifId);
|
||||||
|
|
||||||
if (isset($requestedNotifications[$notifId])) {
|
if (isset($requestedNotifications[$notifId])) {
|
||||||
$user->setPrefs($notifName, '1');
|
$app['phraseanet.user']->setPrefs($notifName, '1');
|
||||||
} else {
|
} else {
|
||||||
$user->setPrefs($notifName, '0');
|
$app['phraseanet.user']->setPrefs($notifName, '0');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -370,19 +370,17 @@ class Developers implements ControllerProviderInterface
|
|||||||
*/
|
*/
|
||||||
public function getApp(Application $app, Request $request, $id)
|
public function getApp(Application $app, Request $request, $id)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$client = new \API_OAuth2_Application($app, $id);
|
$client = new \API_OAuth2_Application($app, $id);
|
||||||
} catch (\Exception_NotFound $e) {
|
} catch (\Exception_NotFound $e) {
|
||||||
$app->abort(404);
|
$app->abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$token = $client->get_user_account($user)->get_token()->get_value();
|
$token = $client->get_user_account($app['phraseanet.user'])->get_token()->get_value();
|
||||||
|
|
||||||
return $app['twig']->render('developers/application.html.twig', array(
|
return $app['twig']->render('developers/application.html.twig', array(
|
||||||
"application" => $client,
|
"application" => $client,
|
||||||
"user" => $user,
|
"user" => $app['phraseanet.user'],
|
||||||
"token" => $token
|
"token" => $token
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@@ -28,15 +28,14 @@ class Prod extends Helper
|
|||||||
);
|
);
|
||||||
|
|
||||||
$bases = $fields = $dates = array();
|
$bases = $fields = $dates = array();
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
|
|
||||||
if ( ! $user instanceof \User_Adapter) {
|
if ( ! $this->app['phraseanet.user'] instanceof \User_Adapter) {
|
||||||
return $search_datas;
|
return $search_datas;
|
||||||
}
|
}
|
||||||
|
|
||||||
$searchSet = $user->getPrefs('search');
|
$searchSet = $this->app['phraseanet.user']->getPrefs('search');
|
||||||
|
|
||||||
foreach ($user->ACL()->get_granted_sbas() as $databox) {
|
foreach ($this->app['phraseanet.user']->ACL()->get_granted_sbas() as $databox) {
|
||||||
$sbas_id = $databox->get_sbas_id();
|
$sbas_id = $databox->get_sbas_id();
|
||||||
|
|
||||||
$bases[$sbas_id] = array(
|
$bases[$sbas_id] = array(
|
||||||
@@ -46,7 +45,7 @@ class Prod extends Helper
|
|||||||
'sbas_id' => $sbas_id
|
'sbas_id' => $sbas_id
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($user->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $coll) {
|
foreach ($this->app['phraseanet.user']->ACL()->get_granted_base(array(), array($databox->get_sbas_id())) as $coll) {
|
||||||
$selected = ($searchSet &&
|
$selected = ($searchSet &&
|
||||||
isset($searchSet->bases) &&
|
isset($searchSet->bases) &&
|
||||||
isset($searchSet->bases->$sbas_id)) ? (in_array($coll->get_base_id(), $searchSet->bases->$sbas_id)) : true;
|
isset($searchSet->bases->$sbas_id)) ? (in_array($coll->get_base_id(), $searchSet->bases->$sbas_id)) : true;
|
||||||
@@ -85,7 +84,7 @@ class Prod extends Helper
|
|||||||
if ( ! $bases[$sbas_id]['thesaurus']) {
|
if ( ! $bases[$sbas_id]['thesaurus']) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( ! $user->ACL()->has_right_on_sbas($sbas_id, 'bas_modif_th')) {
|
if ( ! $this->app['phraseanet.user']->ACL()->has_right_on_sbas($sbas_id, 'bas_modif_th')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -70,9 +70,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
|
|||||||
|
|
||||||
protected function delete_user(\User_Adapter $user)
|
protected function delete_user(\User_Adapter $user)
|
||||||
{
|
{
|
||||||
$master = $this->app['phraseanet.user'];
|
$list = array_keys($this->app['phraseanet.user']->ACL()->get_granted_base(array('canadmin')));
|
||||||
|
|
||||||
$list = array_keys($master->ACL()->get_granted_base(array('canadmin')));
|
|
||||||
|
|
||||||
$user->ACL()->revoke_access_from_bases($list);
|
$user->ACL()->revoke_access_from_bases($list);
|
||||||
|
|
||||||
@@ -85,9 +83,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
|
|||||||
|
|
||||||
public function get_users_rights()
|
public function get_users_rights()
|
||||||
{
|
{
|
||||||
$user = $this->app['phraseanet.user'];
|
$list = array_keys($this->app['phraseanet.user']->ACL()->get_granted_base(array('canadmin')));
|
||||||
|
|
||||||
$list = array_keys($user->ACL()->get_granted_base(array('canadmin')));
|
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
b.sbas_id,
|
b.sbas_id,
|
||||||
@@ -555,9 +551,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
|
|||||||
throw new \Exception_Forbidden('You are not the owner of the template');
|
throw new \Exception_Forbidden('You are not the owner of the template');
|
||||||
}
|
}
|
||||||
|
|
||||||
$current_user = $this->app['phraseanet.user'];
|
$base_ids = array_keys($this->app['phraseanet.user']->ACL()->get_granted_base(array('canadmin')));
|
||||||
|
|
||||||
$base_ids = array_keys($current_user->ACL()->get_granted_base(array('canadmin')));
|
|
||||||
|
|
||||||
foreach ($this->users as $usr_id) {
|
foreach ($this->users as $usr_id) {
|
||||||
$user = \User_adapter::getInstance($usr_id, $this->app);
|
$user = \User_adapter::getInstance($usr_id, $this->app);
|
||||||
@@ -625,9 +619,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
|
|||||||
|
|
||||||
public function resetRights()
|
public function resetRights()
|
||||||
{
|
{
|
||||||
$authUser = $this->app['phraseanet.user'];
|
$base_ids = array_keys($this->app['phraseanet.user']->ACL()->get_granted_base(array('canadmin')));
|
||||||
$adminACL = $authUser->ACL();
|
|
||||||
$base_ids = array_keys($adminACL->get_granted_base(array('canadmin')));
|
|
||||||
|
|
||||||
foreach ($this->users as $usr_id) {
|
foreach ($this->users as $usr_id) {
|
||||||
$user = \User_Adapter::getInstance($usr_id, $this->app);
|
$user = \User_Adapter::getInstance($usr_id, $this->app);
|
||||||
@@ -636,7 +628,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
|
|||||||
if ($user->is_template()) {
|
if ($user->is_template()) {
|
||||||
$template = $user;
|
$template = $user;
|
||||||
|
|
||||||
if ($template->get_template_owner()->get_id() !== $authUser->get_id()) {
|
if ($template->get_template_owner()->get_id() !== $this->app['phraseanet.user']->get_id()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,6 @@ class Manage extends Helper
|
|||||||
, 'offset_start' => 0
|
, 'offset_start' => 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
$query = new \User_Query($this->app);
|
$query = new \User_Query($this->app);
|
||||||
|
|
||||||
if (is_array($this->query_parms['base_id']))
|
if (is_array($this->query_parms['base_id']))
|
||||||
@@ -68,7 +67,7 @@ class Manage extends Helper
|
|||||||
->like($this->query_parms['like_field'], $this->query_parms['like_value'])
|
->like($this->query_parms['like_field'], $this->query_parms['like_value'])
|
||||||
->get_inactives($this->query_parms['inactives'])
|
->get_inactives($this->query_parms['inactives'])
|
||||||
->include_templates(false)
|
->include_templates(false)
|
||||||
->on_bases_where_i_am($user->ACL(), array('canadmin'))
|
->on_bases_where_i_am($this->app['phraseanet.user']->ACL(), array('canadmin'))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
return $this->results->get_results();
|
return $this->results->get_results();
|
||||||
@@ -95,7 +94,6 @@ class Manage extends Helper
|
|||||||
, 'offset_start' => $offset_start
|
, 'offset_start' => $offset_start
|
||||||
);
|
);
|
||||||
|
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
$query = new \User_Query($this->app);
|
$query = new \User_Query($this->app);
|
||||||
|
|
||||||
if (is_array($this->query_parms['base_id']))
|
if (is_array($this->query_parms['base_id']))
|
||||||
@@ -107,7 +105,7 @@ class Manage extends Helper
|
|||||||
->like($this->query_parms['like_field'], $this->query_parms['like_value'])
|
->like($this->query_parms['like_field'], $this->query_parms['like_value'])
|
||||||
->get_inactives($this->query_parms['inactives'])
|
->get_inactives($this->query_parms['inactives'])
|
||||||
->include_templates(true)
|
->include_templates(true)
|
||||||
->on_bases_where_i_am($user->ACL(), array('canadmin'))
|
->on_bases_where_i_am($this->app['phraseanet.user']->ACL(), array('canadmin'))
|
||||||
->limit($offset_start, $results_quantity)
|
->limit($offset_start, $results_quantity)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
@@ -196,11 +194,9 @@ class Manage extends Helper
|
|||||||
throw new \Exception_InvalidArgument(_('Invalid template name'));
|
throw new \Exception_InvalidArgument(_('Invalid template name'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
|
|
||||||
$created_user = \User_Adapter::create($this->app, $name, \random::generatePassword(16), null, false, false);
|
$created_user = \User_Adapter::create($this->app, $name, \random::generatePassword(16), null, false, false);
|
||||||
$created_user->set_template($user);
|
$created_user->set_template($this->app['phraseanet.user']);
|
||||||
$this->usr_id = $user->get_id();
|
$this->usr_id = $this->app['phraseanet.user']->get_id();
|
||||||
|
|
||||||
return $created_user;
|
return $created_user;
|
||||||
}
|
}
|
||||||
|
@@ -38,8 +38,6 @@ class WorkZone extends Helper
|
|||||||
*/
|
*/
|
||||||
public function getContent($sort)
|
public function getContent($sort)
|
||||||
{
|
{
|
||||||
$current_user = $this->app['phraseanet.user'];
|
|
||||||
|
|
||||||
/* @var $repo_baskets \Doctrine\Repositories\BasketRepository */
|
/* @var $repo_baskets \Doctrine\Repositories\BasketRepository */
|
||||||
$repo_baskets = $this->app['EM']->getRepository('Entities\Basket');
|
$repo_baskets = $this->app['EM']->getRepository('Entities\Basket');
|
||||||
|
|
||||||
@@ -47,13 +45,13 @@ class WorkZone extends Helper
|
|||||||
|
|
||||||
$ret = new \Doctrine\Common\Collections\ArrayCollection();
|
$ret = new \Doctrine\Common\Collections\ArrayCollection();
|
||||||
|
|
||||||
$baskets = $repo_baskets->findActiveByUser($current_user, $sort);
|
$baskets = $repo_baskets->findActiveByUser($this->app['phraseanet.user'], $sort);
|
||||||
$validations = $repo_baskets->findActiveValidationByUser($current_user, $sort);
|
$validations = $repo_baskets->findActiveValidationByUser($this->app['phraseanet.user'], $sort);
|
||||||
|
|
||||||
/* @var $repo_stories \Doctrine\Repositories\StoryWZRepository */
|
/* @var $repo_stories \Doctrine\Repositories\StoryWZRepository */
|
||||||
$repo_stories = $this->app['EM']->getRepository('Entities\StoryWZ');
|
$repo_stories = $this->app['EM']->getRepository('Entities\StoryWZ');
|
||||||
|
|
||||||
$stories = $repo_stories->findByUser($this->app, $current_user, $sort);
|
$stories = $repo_stories->findByUser($this->app, $this->app['phraseanet.user'], $sort);
|
||||||
|
|
||||||
$ret->set(self::BASKETS, $baskets);
|
$ret->set(self::BASKETS, $baskets);
|
||||||
$ret->set(self::VALIDATIONS, $validations);
|
$ret->set(self::VALIDATIONS, $validations);
|
||||||
|
@@ -124,8 +124,6 @@ class PDF
|
|||||||
|
|
||||||
protected function print_thumbnailGrid($links = false)
|
protected function print_thumbnailGrid($links = false)
|
||||||
{
|
{
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
|
|
||||||
$NDiapoW = 3;
|
$NDiapoW = 3;
|
||||||
$NDiapoH = 4;
|
$NDiapoH = 4;
|
||||||
|
|
||||||
@@ -168,7 +166,7 @@ class PDF
|
|||||||
|
|
||||||
$fimg = $subdef->get_pathfile();
|
$fimg = $subdef->get_pathfile();
|
||||||
|
|
||||||
if (!$user->ACL()->has_right_on_base($rec->get_base_id(), "nowatermark")
|
if (!$this->app['phraseanet.user']->ACL()->has_right_on_base($rec->get_base_id(), "nowatermark")
|
||||||
&& $subdef->get_type() == \media_subdef::TYPE_IMAGE) {
|
&& $subdef->get_type() == \media_subdef::TYPE_IMAGE) {
|
||||||
$fimg = \recordutils_image::watermark($this->app, $subdef);
|
$fimg = \recordutils_image::watermark($this->app, $subdef);
|
||||||
}
|
}
|
||||||
@@ -310,8 +308,6 @@ class PDF
|
|||||||
|
|
||||||
protected function print_preview($withtdm, $write_caption)
|
protected function print_preview($withtdm, $write_caption)
|
||||||
{
|
{
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
|
|
||||||
if ($withtdm === true) {
|
if ($withtdm === true) {
|
||||||
$this->print_thumbnailGrid($this->pdf, $this->records, true);
|
$this->print_thumbnailGrid($this->pdf, $this->records, true);
|
||||||
}
|
}
|
||||||
@@ -433,7 +429,7 @@ class PDF
|
|||||||
|
|
||||||
$f = $subdef->get_pathfile();
|
$f = $subdef->get_pathfile();
|
||||||
|
|
||||||
if (!$user->ACL()->has_right_on_base($rec->get_base_id(), "nowatermark")
|
if (!$this->app['phraseanet.user']->ACL()->has_right_on_base($rec->get_base_id(), "nowatermark")
|
||||||
&& $subdef->get_type() == \media_subdef::TYPE_IMAGE)
|
&& $subdef->get_type() == \media_subdef::TYPE_IMAGE)
|
||||||
$f = \recordutils_image::watermark($this->app, $subdef);
|
$f = \recordutils_image::watermark($this->app, $subdef);
|
||||||
|
|
||||||
|
@@ -727,9 +727,7 @@ class API_V1_adapter extends API_V1_Abstract
|
|||||||
$offset_start = max($request->get('offset_start', 0), 0);
|
$offset_start = max($request->get('offset_start', 0), 0);
|
||||||
$per_page = min(max($request->get('per_page', 10), 1), 20);
|
$per_page = min(max($request->get('per_page', 10), 1), 20);
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
$baseIds = array_keys($app['phraseanet.user']->ACL()->get_granted_base(array('canaddrecord')));
|
||||||
/* @var $user \User_Adapter */
|
|
||||||
$baseIds = array_keys($user->ACL()->get_granted_base(array('canaddrecord')));
|
|
||||||
|
|
||||||
$lazaretFiles = array();
|
$lazaretFiles = array();
|
||||||
|
|
||||||
@@ -825,7 +823,6 @@ class API_V1_adapter extends API_V1_Abstract
|
|||||||
*/
|
*/
|
||||||
public function search_records(Request $request)
|
public function search_records(Request $request)
|
||||||
{
|
{
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
$result = new API_V1_result($request, $this);
|
$result = new API_V1_result($request, $this);
|
||||||
|
|
||||||
$search_type = ($request->get('search_type')
|
$search_type = ($request->get('search_type')
|
||||||
@@ -866,15 +863,14 @@ class API_V1_adapter extends API_V1_Abstract
|
|||||||
|
|
||||||
$options = new searchEngine_options();
|
$options = new searchEngine_options();
|
||||||
|
|
||||||
$params['bases'] = is_array($params['bases']) ? $params['bases'] : array_keys($user->ACL()->get_granted_base());
|
$params['bases'] = is_array($params['bases']) ? $params['bases'] : array_keys($this->app['phraseanet.user']->ACL()->get_granted_base());
|
||||||
|
|
||||||
/* @var $user \User_Adapter */
|
if ($this->app['phraseanet.user']->ACL()->has_right('modifyrecord')) {
|
||||||
if ($user->ACL()->has_right('modifyrecord')) {
|
|
||||||
$options->set_business_fields(array());
|
$options->set_business_fields(array());
|
||||||
|
|
||||||
$BF = array();
|
$BF = array();
|
||||||
|
|
||||||
foreach ($user->ACL()->get_granted_base(array('canmodifrecord')) as $collection) {
|
foreach ($this->app['phraseanet.user']->ACL()->get_granted_base(array('canmodifrecord')) as $collection) {
|
||||||
if (count($params['bases']) === 0 || in_array($collection->get_base_id(), $params['bases'])) {
|
if (count($params['bases']) === 0 || in_array($collection->get_base_id(), $params['bases'])) {
|
||||||
$BF[] = $collection->get_base_id();
|
$BF[] = $collection->get_base_id();
|
||||||
}
|
}
|
||||||
@@ -884,7 +880,7 @@ class API_V1_adapter extends API_V1_Abstract
|
|||||||
$options->set_business_fields(array());
|
$options->set_business_fields(array());
|
||||||
}
|
}
|
||||||
|
|
||||||
$options->set_bases($params['bases'], $user->ACL());
|
$options->set_bases($params['bases'], $this->app['phraseanet.user']->ACL());
|
||||||
|
|
||||||
if ( ! is_array($params['fields'])) {
|
if ( ! is_array($params['fields'])) {
|
||||||
$params['fields'] = array();
|
$params['fields'] = array();
|
||||||
@@ -1222,10 +1218,8 @@ class API_V1_adapter extends API_V1_Abstract
|
|||||||
throw new API_V1_exception_badrequest('Missing basket name parameter');
|
throw new API_V1_exception_badrequest('Missing basket name parameter');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
|
|
||||||
$Basket = new \Entities\Basket();
|
$Basket = new \Entities\Basket();
|
||||||
$Basket->setOwner($user);
|
$Basket->setOwner($this->app['phraseanet.user']);
|
||||||
$Basket->setName($name);
|
$Basket->setName($name);
|
||||||
|
|
||||||
$this->app['EM']->persist($Basket);
|
$this->app['EM']->persist($Basket);
|
||||||
|
@@ -465,8 +465,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
|||||||
public static function saveQuery(Application $app, $query)
|
public static function saveQuery(Application $app, $query)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$sql = "INSERT INTO dsel (id, name, usr_id, query)
|
$sql = "INSERT INTO dsel (id, name, usr_id, query)
|
||||||
VALUES (null, :name, :usr_id, :query)";
|
VALUES (null, :name, :usr_id, :query)";
|
||||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||||
@@ -477,8 +475,8 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
|
|||||||
));
|
));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if ($user->getPrefs('start_page') == 'LAST_QUERY')
|
if ($app['phraseanet.user']->getPrefs('start_page') == 'LAST_QUERY')
|
||||||
$user->setPrefs('start_page_query', $query);
|
$app['phraseanet.user']->setPrefs('start_page_query', $query);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -51,10 +51,6 @@ class databox_cgu
|
|||||||
{
|
{
|
||||||
$terms = array();
|
$terms = array();
|
||||||
|
|
||||||
if ( ! $home) {
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||||
try {
|
try {
|
||||||
$cgus = $databox->get_cgus();
|
$cgus = $databox->get_cgus();
|
||||||
@@ -68,10 +64,10 @@ class databox_cgu
|
|||||||
$userValidation = true;
|
$userValidation = true;
|
||||||
|
|
||||||
if ( ! $home) {
|
if ( ! $home) {
|
||||||
if ( ! $user->ACL()->has_access_to_sbas($databox->get_sbas_id())) {
|
if ( ! $app['phraseanet.user']->ACL()->has_access_to_sbas($databox->get_sbas_id())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$userValidation = ($user->getPrefs('terms_of_use_' . $databox->get_sbas_id()) !== $update && trim($value) !== '');
|
$userValidation = ($app['phraseanet.user']->getPrefs('terms_of_use_' . $databox->get_sbas_id()) !== $update && trim($value) !== '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($userValidation)
|
if ($userValidation)
|
||||||
|
@@ -125,9 +125,7 @@ class databox_status
|
|||||||
return self::$_statuses;
|
return self::$_statuses;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
$sbas_ids = $app['phraseanet.user']->ACL()->get_granted_sbas();
|
||||||
|
|
||||||
$sbas_ids = $user->ACL()->get_granted_sbas();
|
|
||||||
|
|
||||||
$statuses = array();
|
$statuses = array();
|
||||||
|
|
||||||
@@ -146,11 +144,9 @@ class databox_status
|
|||||||
|
|
||||||
public static function getSearchStatus(Application $app)
|
public static function getSearchStatus(Application $app)
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$statuses = array();
|
$statuses = array();
|
||||||
|
|
||||||
$sbas_ids = $user->ACL()->get_granted_sbas();
|
$sbas_ids = $app['phraseanet.user']->ACL()->get_granted_sbas();
|
||||||
|
|
||||||
$see_all = array();
|
$see_all = array();
|
||||||
|
|
||||||
@@ -158,7 +154,7 @@ class databox_status
|
|||||||
$see_all[$databox->get_sbas_id()] = false;
|
$see_all[$databox->get_sbas_id()] = false;
|
||||||
|
|
||||||
foreach ($databox->get_collections() as $collection) {
|
foreach ($databox->get_collections() as $collection) {
|
||||||
if ($user->ACL()->has_right_on_base($collection->get_base_id(), 'chgstatus')) {
|
if ($app['phraseanet.user']->ACL()->has_right_on_base($collection->get_base_id(), 'chgstatus')) {
|
||||||
$see_all[$databox->get_sbas_id()] = true;
|
$see_all[$databox->get_sbas_id()] = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -176,8 +172,9 @@ class databox_status
|
|||||||
|
|
||||||
$see_this = isset($see_all[$sbas_id]) ? $see_all[$sbas_id] : false;
|
$see_this = isset($see_all[$sbas_id]) ? $see_all[$sbas_id] : false;
|
||||||
|
|
||||||
if ($user->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct'))
|
if ($app['phraseanet.user']->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct')) {
|
||||||
$see_this = true;
|
$see_this = true;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($status as $bit => $props) {
|
foreach ($status as $bit => $props) {
|
||||||
|
|
||||||
|
@@ -20,8 +20,7 @@ function deleteRecord(Application $app, $lst, $del_children)
|
|||||||
{
|
{
|
||||||
$BE_repository = $app['EM']->getRepository('\Entities\BasketElement');
|
$BE_repository = $app['EM']->getRepository('\Entities\BasketElement');
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
$ACL = $app['phraseanet.user']->ACL();
|
||||||
$ACL = $user->ACL();
|
|
||||||
|
|
||||||
$lst = explode(";", $lst);
|
$lst = explode(";", $lst);
|
||||||
|
|
||||||
|
@@ -266,13 +266,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if ($this->app['phraseanet.user']->ACL()->has_right('manageusers') === true) {
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->ACL()->has_right('manageusers') === true) {
|
|
||||||
$bool = true;
|
$bool = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -240,13 +240,7 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if ($this->app['phraseanet.user']->ACL()->has_right('order_master')) {
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->ACL()->has_right('order_master')) {
|
|
||||||
$bool = true;
|
$bool = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -270,13 +270,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if ($this->app['phraseanet.user']->ACL()->has_right('manageusers')) {
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->ACL()->has_right('manageusers')) {
|
|
||||||
$bool = true;
|
$bool = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -215,13 +215,7 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if ($this->app['phraseanet.user']->ACL()->has_right('push')) {
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->ACL()->has_right('push')) {
|
|
||||||
$bool = true;
|
$bool = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -160,17 +160,15 @@ class gatekeeper
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
|
|
||||||
switch ($this->_directory) {
|
switch ($this->_directory) {
|
||||||
case 'admin':
|
case 'admin':
|
||||||
case 'taskmanager':
|
case 'taskmanager':
|
||||||
if (!$user->ACL()->has_access_to_module('admin')) {
|
if (!$this->app['phraseanet.user']->ACL()->has_access_to_module('admin')) {
|
||||||
phrasea::headers(403);
|
phrasea::headers(403);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'thesaurus2':
|
case 'thesaurus2':
|
||||||
if (!$user->ACL()->has_access_to_module('thesaurus')) {
|
if (!$this->app['phraseanet.user']->ACL()->has_access_to_module('thesaurus')) {
|
||||||
phrasea::headers(403);
|
phrasea::headers(403);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -180,12 +178,12 @@ class gatekeeper
|
|||||||
$this->token_access();
|
$this->token_access();
|
||||||
break;
|
break;
|
||||||
case 'upload':
|
case 'upload':
|
||||||
if (!$user->ACL()->has_right('addrecord')) {
|
if (!$this->app['phraseanet.user']->ACL()->has_right('addrecord')) {
|
||||||
phrasea::headers(403);
|
phrasea::headers(403);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'report':
|
case 'report':
|
||||||
if (!$user->ACL()->has_right('report')) {
|
if (!$this->app['phraseanet.user']->ACL()->has_right('report')) {
|
||||||
phrasea::headers(403);
|
phrasea::headers(403);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -12,8 +12,6 @@ class liste
|
|||||||
|
|
||||||
$okbrec = array();
|
$okbrec = array();
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
foreach ($lst as $basrec) {
|
foreach ($lst as $basrec) {
|
||||||
$basrec = explode("_", $basrec);
|
$basrec = explode("_", $basrec);
|
||||||
if ( ! $basrec || count($basrec) != 2) {
|
if ( ! $basrec || count($basrec) != 2) {
|
||||||
@@ -25,25 +23,23 @@ class liste
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->ACL()->has_hd_grant($record)) {
|
if ($app['phraseanet.user']->ACL()->has_hd_grant($record)) {
|
||||||
$okbrec[] = implode('_', $basrec);
|
$okbrec[] = implode('_', $basrec);
|
||||||
;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($user->ACL()->has_preview_grant($record)) {
|
if ($app['phraseanet.user']->ACL()->has_preview_grant($record)) {
|
||||||
$okbrec[] = implode('_', $basrec);
|
$okbrec[] = implode('_', $basrec);
|
||||||
;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $user->ACL()->has_access_to_base($record->get_base_id()))
|
if ( ! $app['phraseanet.user']->ACL()->has_access_to_base($record->get_base_id()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$connsbas = connection::getPDOConnection($app, $basrec[0]);
|
$connsbas = connection::getPDOConnection($app, $basrec[0]);
|
||||||
|
|
||||||
$sql = 'SELECT record_id FROM record WHERE ((status ^ ' . $user->ACL()->get_mask_xor($record->get_base_id()) . ')
|
$sql = 'SELECT record_id FROM record WHERE ((status ^ ' . $app['phraseanet.user']->ACL()->get_mask_xor($record->get_base_id()) . ')
|
||||||
& ' . $user->ACL()->get_mask_and($record->get_base_id()) . ')=0' .
|
& ' . $app['phraseanet.user']->ACL()->get_mask_and($record->get_base_id()) . ')=0' .
|
||||||
' AND record_id = :record_id';
|
' AND record_id = :record_id';
|
||||||
|
|
||||||
$stmt = $connsbas->prepare($sql);
|
$stmt = $connsbas->prepare($sql);
|
||||||
|
@@ -75,7 +75,6 @@ class phrasea
|
|||||||
|
|
||||||
public function getHome(Application $app, $type = 'PUBLI', $context = 'prod')
|
public function getHome(Application $app, $type = 'PUBLI', $context = 'prod')
|
||||||
{
|
{
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
if ($type == 'HELP') {
|
if ($type == 'HELP') {
|
||||||
if (file_exists($app['phraseanet.registry']->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php")) {
|
if (file_exists($app['phraseanet.registry']->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php")) {
|
||||||
require($app['phraseanet.registry']->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php");
|
require($app['phraseanet.registry']->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php");
|
||||||
@@ -99,17 +98,16 @@ class phrasea
|
|||||||
|
|
||||||
$bas = array();
|
$bas = array();
|
||||||
|
|
||||||
$searchSet = json_decode($user->getPrefs('search'));
|
$searchSet = json_decode($app['phraseanet.user']->getPrefs('search'));
|
||||||
|
|
||||||
if ($searchSet && isset($searchSet->bases)) {
|
if ($searchSet && isset($searchSet->bases)) {
|
||||||
foreach ($searchSet->bases as $bases)
|
foreach ($searchSet->bases as $bases)
|
||||||
$bas = array_merge($bas, $bases);
|
$bas = array_merge($bas, $bases);
|
||||||
} else {
|
} else {
|
||||||
$user = $app['phraseanet.user'];
|
$bas = array_keys($app['phraseanet.user']->ACL()->get_granted_base());
|
||||||
$bas = array_keys($user->ACL()->get_granted_base());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$start_page_query = $user->getPrefs('start_page_query');
|
$start_page_query = $app['phraseanet.user']->getPrefs('start_page_query');
|
||||||
|
|
||||||
if ($context == "prod") {
|
if ($context == "prod") {
|
||||||
$parm["bas"] = $bas;
|
$parm["bas"] = $bas;
|
||||||
@@ -126,7 +124,7 @@ class phrasea
|
|||||||
$parm["datefield"] = '';
|
$parm["datefield"] = '';
|
||||||
}
|
}
|
||||||
if ($context == "client") {
|
if ($context == "client") {
|
||||||
$parm["mod"] = $user->getPrefs('client_view');
|
$parm["mod"] = $app['phraseanet.user']->getPrefs('client_view');
|
||||||
$parm["bas"] = $bas;
|
$parm["bas"] = $bas;
|
||||||
$parm["qry"] = $start_page_query;
|
$parm["qry"] = $start_page_query;
|
||||||
$parm["pag"] = '';
|
$parm["pag"] = '';
|
||||||
|
@@ -394,14 +394,13 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
{
|
{
|
||||||
$dstatus = databox_status::getDisplayStatus($this->app);
|
$dstatus = databox_status::getDisplayStatus($this->app);
|
||||||
$sbas_id = $this->get_sbas_id();
|
$sbas_id = $this->get_sbas_id();
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
|
|
||||||
$status = '';
|
$status = '';
|
||||||
|
|
||||||
if (isset($dstatus[$sbas_id])) {
|
if (isset($dstatus[$sbas_id])) {
|
||||||
foreach ($dstatus[$sbas_id] as $n => $statbit) {
|
foreach ($dstatus[$sbas_id] as $n => $statbit) {
|
||||||
if ($statbit['printable'] == '0' &&
|
if ($statbit['printable'] == '0' &&
|
||||||
!$user->ACL()->has_right_on_base($this->base_id, 'chgstatus')) {
|
!$this->app['phraseanet.user']->ACL()->has_right_on_base($this->base_id, 'chgstatus')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -82,8 +82,6 @@ class record_exportElement extends record_adapter
|
|||||||
|
|
||||||
$sbas_id = phrasea::sbasFromBas($this->app, $this->base_id);
|
$sbas_id = phrasea::sbasFromBas($this->app, $this->base_id);
|
||||||
|
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
|
|
||||||
$subdefgroups = $this->app['phraseanet.appbox']->get_databox($sbas_id)->get_subdef_structure();
|
$subdefgroups = $this->app['phraseanet.appbox']->get_databox($sbas_id)->get_subdef_structure();
|
||||||
|
|
||||||
$subdefs = array();
|
$subdefs = array();
|
||||||
@@ -101,17 +99,17 @@ class record_exportElement extends record_adapter
|
|||||||
'thumbnail' => true
|
'thumbnail' => true
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($user->ACL()->has_right_on_base($this->get_base_id(), 'candwnldhd')) {
|
if ($this->app['phraseanet.user']->ACL()->has_right_on_base($this->get_base_id(), 'candwnldhd')) {
|
||||||
$go_dl['document'] = true;
|
$go_dl['document'] = true;
|
||||||
}
|
}
|
||||||
if ($user->ACL()->has_right_on_base($this->get_base_id(), 'candwnldpreview')) {
|
if ($this->app['phraseanet.user']->ACL()->has_right_on_base($this->get_base_id(), 'candwnldpreview')) {
|
||||||
$go_dl['preview'] = true;
|
$go_dl['preview'] = true;
|
||||||
}
|
}
|
||||||
if ($user->ACL()->has_hd_grant($this)) {
|
if ($this->app['phraseanet.user']->ACL()->has_hd_grant($this)) {
|
||||||
$go_dl['document'] = true;
|
$go_dl['document'] = true;
|
||||||
$go_dl['preview'] = true;
|
$go_dl['preview'] = true;
|
||||||
}
|
}
|
||||||
if ($user->ACL()->has_preview_grant($this)) {
|
if ($this->app['phraseanet.user']->ACL()->has_preview_grant($this)) {
|
||||||
$go_dl['preview'] = true;
|
$go_dl['preview'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,14 +119,14 @@ class record_exportElement extends record_adapter
|
|||||||
->who_have_right(array('order_master'))
|
->who_have_right(array('order_master'))
|
||||||
->execute()->get_results();
|
->execute()->get_results();
|
||||||
|
|
||||||
$go_cmd = (count($masters) > 0 && $user->ACL()->has_right_on_base($this->base_id, 'cancmd'));
|
$go_cmd = (count($masters) > 0 && $this->app['phraseanet.user']->ACL()->has_right_on_base($this->base_id, 'cancmd'));
|
||||||
|
|
||||||
$orderable['document'] = false;
|
$orderable['document'] = false;
|
||||||
$downloadable['document'] = false;
|
$downloadable['document'] = false;
|
||||||
|
|
||||||
if (isset($sd['document']) && is_file($sd['document']->get_pathfile())) {
|
if (isset($sd['document']) && is_file($sd['document']->get_pathfile())) {
|
||||||
if ($go_dl['document'] === true) {
|
if ($go_dl['document'] === true) {
|
||||||
if ($user->ACL()->is_restricted_download($this->base_id)) {
|
if ($this->app['phraseanet.user']->ACL()->is_restricted_download($this->base_id)) {
|
||||||
$this->remain_hd --;
|
$this->remain_hd --;
|
||||||
if ($this->remain_hd >= 0)
|
if ($this->remain_hd >= 0)
|
||||||
$downloadable['document'] = array(
|
$downloadable['document'] = array(
|
||||||
@@ -176,7 +174,7 @@ class record_exportElement extends record_adapter
|
|||||||
if (isset($sd[$name]) && is_file($sd[$name]->get_pathfile())) {
|
if (isset($sd[$name]) && is_file($sd[$name]->get_pathfile())) {
|
||||||
if ($class == 'document') {
|
if ($class == 'document') {
|
||||||
|
|
||||||
if ($user->ACL()->is_restricted_download($this->base_id)) {
|
if ($this->app['phraseanet.user']->ACL()->is_restricted_download($this->base_id)) {
|
||||||
$this->remain_hd --;
|
$this->remain_hd --;
|
||||||
if ($this->remain_hd >= 0)
|
if ($this->remain_hd >= 0)
|
||||||
$downloadable[$name] = array(
|
$downloadable[$name] = array(
|
||||||
|
@@ -316,9 +316,7 @@ class record_preview extends record_adapter
|
|||||||
|
|
||||||
$tab = array();
|
$tab = array();
|
||||||
|
|
||||||
$user = $this->app['phraseanet.user'];
|
$report = $this->app['phraseanet.user']->ACL()->has_right_on_base($this->get_base_id(), 'canreport');
|
||||||
|
|
||||||
$report = $user->ACL()->has_right_on_base($this->get_base_id(), 'canreport');
|
|
||||||
|
|
||||||
$connsbas = connection::getPDOConnection($this->app, $this->get_sbas_id());
|
$connsbas = connection::getPDOConnection($this->app, $this->get_sbas_id());
|
||||||
|
|
||||||
@@ -330,7 +328,7 @@ class record_preview extends record_adapter
|
|||||||
|
|
||||||
if ( ! $report) {
|
if ( ! $report) {
|
||||||
$sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")';
|
$sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")';
|
||||||
$params[':usr_id'] = $user->get_id();
|
$params[':usr_id'] = $this->app['phraseanet.user']->get_id();
|
||||||
$params[':site'] = $this->app['phraseanet.registry']->get('GV_sit');
|
$params[':site'] = $this->app['phraseanet.registry']->get('GV_sit');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,8 +399,7 @@ class record_preview extends record_adapter
|
|||||||
return $this->view_popularity;
|
return $this->view_popularity;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->app['phraseanet.user'];
|
$report = $this->app['phraseanet.user']->ACL()->has_right_on_base(
|
||||||
$report = $user->ACL()->has_right_on_base(
|
|
||||||
$this->get_base_id(), 'canreport');
|
$this->get_base_id(), 'canreport');
|
||||||
|
|
||||||
if ( ! $report && ! $this->app['phraseanet.registry']->get('GV_google_api')) {
|
if ( ! $report && ! $this->app['phraseanet.registry']->get('GV_google_api')) {
|
||||||
@@ -491,8 +488,7 @@ class record_preview extends record_adapter
|
|||||||
return $this->refferer_popularity;
|
return $this->refferer_popularity;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->app['phraseanet.user'];
|
$report = $this->app['phraseanet.user']->ACL()->has_right_on_base(
|
||||||
$report = $user->ACL()->has_right_on_base(
|
|
||||||
$this->get_base_id(), 'canreport');
|
$this->get_base_id(), 'canreport');
|
||||||
|
|
||||||
if ( ! $report && ! $this->app['phraseanet.registry']->get('GV_google_api')) {
|
if ( ! $report && ! $this->app['phraseanet.registry']->get('GV_google_api')) {
|
||||||
@@ -566,14 +562,11 @@ class record_preview extends record_adapter
|
|||||||
*/
|
*/
|
||||||
public function get_download_popularity()
|
public function get_download_popularity()
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( ! is_null($this->download_popularity)) {
|
if ( ! is_null($this->download_popularity)) {
|
||||||
return $this->download_popularity;
|
return $this->download_popularity;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->app['phraseanet.user'];
|
$report = $this->app['phraseanet.user']->ACL()->has_right_on_base($this->get_base_id(), 'canreport');
|
||||||
$report = $user->ACL()->has_right_on_base(
|
|
||||||
$this->get_base_id(), 'canreport');
|
|
||||||
|
|
||||||
$ret = false;
|
$ret = false;
|
||||||
if ( ! $report && ! $this->app['phraseanet.registry']->get('GV_google_api')) {
|
if ( ! $report && ! $this->app['phraseanet.registry']->get('GV_google_api')) {
|
||||||
|
@@ -44,8 +44,6 @@ class set_export extends set_abstract
|
|||||||
{
|
{
|
||||||
$this->app = $app;
|
$this->app = $app;
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$download_list = array();
|
$download_list = array();
|
||||||
|
|
||||||
$remain_hd = array();
|
$remain_hd = array();
|
||||||
@@ -53,7 +51,7 @@ class set_export extends set_abstract
|
|||||||
if ($storyWZid) {
|
if ($storyWZid) {
|
||||||
$repository = $app['EM']->getRepository('\\Entities\\StoryWZ');
|
$repository = $app['EM']->getRepository('\\Entities\\StoryWZ');
|
||||||
|
|
||||||
$storyWZ = $repository->findByUserAndId($this->app, $user, $storyWZid);
|
$storyWZ = $repository->findByUserAndId($this->app, $app['phraseanet.user'], $storyWZid);
|
||||||
|
|
||||||
$lst = $storyWZ->getRecord($this->app)->get_serialize_key();
|
$lst = $storyWZ->getRecord($this->app)->get_serialize_key();
|
||||||
}
|
}
|
||||||
@@ -62,7 +60,7 @@ class set_export extends set_abstract
|
|||||||
$repository = $app['EM']->getRepository('\Entities\Basket');
|
$repository = $app['EM']->getRepository('\Entities\Basket');
|
||||||
|
|
||||||
/* @var $repository \Repositories\BasketRepository */
|
/* @var $repository \Repositories\BasketRepository */
|
||||||
$Basket = $repository->findUserBasket($this->app, $sstid, $user, false);
|
$Basket = $repository->findUserBasket($this->app, $sstid, $app['phraseanet.user'], false);
|
||||||
|
|
||||||
foreach ($Basket->getElements() as $basket_element) {
|
foreach ($Basket->getElements() as $basket_element) {
|
||||||
/* @var $basket_element \Entities\BasketElement */
|
/* @var $basket_element \Entities\BasketElement */
|
||||||
@@ -70,8 +68,8 @@ class set_export extends set_abstract
|
|||||||
$record_id = $basket_element->getRecord($this->app)->get_record_id();
|
$record_id = $basket_element->getRecord($this->app)->get_record_id();
|
||||||
|
|
||||||
if (!isset($remain_hd[$base_id])) {
|
if (!isset($remain_hd[$base_id])) {
|
||||||
if ($user->ACL()->is_restricted_download($base_id)) {
|
if ($app['phraseanet.user']->ACL()->is_restricted_download($base_id)) {
|
||||||
$remain_hd[$base_id] = $user->ACL()->remaining_download($base_id);
|
$remain_hd[$base_id] = $app['phraseanet.user']->ACL()->remaining_download($base_id);
|
||||||
} else {
|
} else {
|
||||||
$remain_hd[$base_id] = false;
|
$remain_hd[$base_id] = false;
|
||||||
}
|
}
|
||||||
@@ -108,9 +106,8 @@ class set_export extends set_abstract
|
|||||||
$record_id = $child_basrec->get_record_id();
|
$record_id = $child_basrec->get_record_id();
|
||||||
|
|
||||||
if (!isset($remain_hd[$base_id])) {
|
if (!isset($remain_hd[$base_id])) {
|
||||||
if ($user->ACL()->is_restricted_download($base_id)) {
|
if ($app['phraseanet.user']->ACL()->is_restricted_download($base_id)) {
|
||||||
$remain_hd[$base_id] =
|
$remain_hd[$base_id] = $app['phraseanet.user']->ACL()->remaining_download($base_id);
|
||||||
$user->ACL()->remaining_download($base_id);
|
|
||||||
} else {
|
} else {
|
||||||
$remain_hd[$base_id] = false;
|
$remain_hd[$base_id] = false;
|
||||||
}
|
}
|
||||||
@@ -132,9 +129,8 @@ class set_export extends set_abstract
|
|||||||
$record_id = $record->get_record_id();
|
$record_id = $record->get_record_id();
|
||||||
|
|
||||||
if (!isset($remain_hd[$base_id])) {
|
if (!isset($remain_hd[$base_id])) {
|
||||||
if ($user->ACL()->is_restricted_download($base_id)) {
|
if ($app['phraseanet.user']->ACL()->is_restricted_download($base_id)) {
|
||||||
$remain_hd[$base_id] =
|
$remain_hd[$base_id] = $app['phraseanet.user']->ACL()->remaining_download($base_id);
|
||||||
$user->ACL()->remaining_download($base_id);
|
|
||||||
} else {
|
} else {
|
||||||
$remain_hd[$base_id] = false;
|
$remain_hd[$base_id] = false;
|
||||||
}
|
}
|
||||||
@@ -168,7 +164,7 @@ class set_export extends set_abstract
|
|||||||
$this->businessFieldsAccess = false;
|
$this->businessFieldsAccess = false;
|
||||||
|
|
||||||
foreach ($this->elements as $download_element) {
|
foreach ($this->elements as $download_element) {
|
||||||
if ($user->ACL()->has_right_on_base($download_element->get_base_id(), 'canmodifrecord')) {
|
if ($app['phraseanet.user']->ACL()->has_right_on_base($download_element->get_base_id(), 'canmodifrecord')) {
|
||||||
$this->businessFieldsAccess = true;
|
$this->businessFieldsAccess = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,11 +216,11 @@ class set_export extends set_abstract
|
|||||||
|
|
||||||
$display_ftp = array();
|
$display_ftp = array();
|
||||||
|
|
||||||
$hasadminright = $user->ACL()->has_right('addrecord')
|
$hasadminright = $app['phraseanet.user']->ACL()->has_right('addrecord')
|
||||||
|| $user->ACL()->has_right('deleterecord')
|
|| $app['phraseanet.user']->ACL()->has_right('deleterecord')
|
||||||
|| $user->ACL()->has_right('modifyrecord')
|
|| $app['phraseanet.user']->ACL()->has_right('modifyrecord')
|
||||||
|| $user->ACL()->has_right('coll_manage')
|
|| $app['phraseanet.user']->ACL()->has_right('coll_manage')
|
||||||
|| $user->ACL()->has_right('coll_modify_struct');
|
|| $app['phraseanet.user']->ACL()->has_right('coll_modify_struct');
|
||||||
|
|
||||||
$this->ftp_datas = array();
|
$this->ftp_datas = array();
|
||||||
|
|
||||||
@@ -232,7 +228,7 @@ class set_export extends set_abstract
|
|||||||
$display_ftp = $display_download;
|
$display_ftp = $display_download;
|
||||||
$this->total_ftp = $this->total_download;
|
$this->total_ftp = $this->total_download;
|
||||||
|
|
||||||
$lst_base_id = array_keys($user->ACL()->get_granted_base());
|
$lst_base_id = array_keys($app['phraseanet.user']->ACL()->get_granted_base());
|
||||||
|
|
||||||
if ($hasadminright) {
|
if ($hasadminright) {
|
||||||
$sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP,
|
$sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP,
|
||||||
@@ -276,7 +272,7 @@ class set_export extends set_abstract
|
|||||||
'passifFTP' => false,
|
'passifFTP' => false,
|
||||||
'retryFTP' => 5,
|
'retryFTP' => 5,
|
||||||
'mailFTP' => '',
|
'mailFTP' => '',
|
||||||
'sendermail' => $user->get_email()
|
'sendermail' => $app['phraseanet.user']->get_email()
|
||||||
);
|
);
|
||||||
|
|
||||||
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||||
@@ -300,7 +296,7 @@ class set_export extends set_abstract
|
|||||||
'passifFTP' => ($row['passifFTP'] > 0),
|
'passifFTP' => ($row['passifFTP'] > 0),
|
||||||
'retryFTP' => $row['retryFTP'],
|
'retryFTP' => $row['retryFTP'],
|
||||||
'mailFTP' => $row['usr_mail'],
|
'mailFTP' => $row['usr_mail'],
|
||||||
'sendermail' => $user->get_email()
|
'sendermail' => $app['phraseanet.user']->get_email()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -847,13 +843,6 @@ class set_export extends set_abstract
|
|||||||
*/
|
*/
|
||||||
public static function log_download(Array $list, $type, $anonymous = false, $comment = '')
|
public static function log_download(Array $list, $type, $anonymous = false, $comment = '')
|
||||||
{
|
{
|
||||||
$user = false;
|
|
||||||
if ($anonymous) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$tmplog = array();
|
$tmplog = array();
|
||||||
$files = $list['files'];
|
$files = $list['files'];
|
||||||
|
|
||||||
@@ -879,8 +868,9 @@ class set_export extends set_abstract
|
|||||||
$log["poids"] = $obj["size"];
|
$log["poids"] = $obj["size"];
|
||||||
$log["shortXml"] = $record_object->get_caption()->serialize(caption_record::SERIALIZE_XML);
|
$log["shortXml"] = $record_object->get_caption()->serialize(caption_record::SERIALIZE_XML);
|
||||||
$tmplog[$record_object->get_base_id()][] = $log;
|
$tmplog[$record_object->get_base_id()][] = $log;
|
||||||
if (!$anonymous && $o == 'document')
|
if (!$anonymous && $o == 'document') {
|
||||||
$user->ACL()->remove_remaining($record_object->get_base_id());
|
$this->app['phraseanet.user']->ACL()->remove_remaining($record_object->get_base_id());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($record_object);
|
unset($record_object);
|
||||||
@@ -903,11 +893,11 @@ class set_export extends set_abstract
|
|||||||
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||||
|
|
||||||
foreach ($list_base as $base_id) {
|
foreach ($list_base as $base_id) {
|
||||||
if ($user->ACL()->is_restricted_download($base_id)) {
|
if ($this->app['phraseanet.user']->ACL()->is_restricted_download($base_id)) {
|
||||||
$params = array(
|
$params = array(
|
||||||
':remain_dl' => $user->ACL()->remaining_download($base_id)
|
':remain_dl' => $this->app['phraseanet.user']->ACL()->remaining_download($base_id)
|
||||||
, ':base_id' => $base_id
|
, ':base_id' => $base_id
|
||||||
, ':usr_id' => $user->get_id()
|
, ':usr_id' => $this->app['phraseanet.user']->get_id()
|
||||||
);
|
);
|
||||||
|
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
|
@@ -33,7 +33,6 @@ class set_exportftp extends set_export
|
|||||||
*/
|
*/
|
||||||
public function export_ftp($usr_to, $host, $login, $password, $ssl, $retry, $passif, $destfolder, $makedirectory, $logfile)
|
public function export_ftp($usr_to, $host, $login, $password, $ssl, $retry, $passif, $destfolder, $makedirectory, $logfile)
|
||||||
{
|
{
|
||||||
$user_f = $this->app['phraseanet.user'];
|
|
||||||
$conn = $this->app['phraseanet.appbox']->get_connection();
|
$conn = $this->app['phraseanet.appbox']->get_connection();
|
||||||
|
|
||||||
$email_dest = '';
|
$email_dest = '';
|
||||||
@@ -44,7 +43,7 @@ class set_exportftp extends set_export
|
|||||||
|
|
||||||
$text_mail_receiver = "Bonjour,\n"
|
$text_mail_receiver = "Bonjour,\n"
|
||||||
. "L'utilisateur "
|
. "L'utilisateur "
|
||||||
. $user_f->get_display_name() . " (login : " . $user_f->get_login() . ") "
|
. $this->app['phraseanet.user']->get_display_name() . " (login : " . $this->app['phraseanet.user']->get_login() . ") "
|
||||||
. "a fait un transfert FTP sur le serveur ayant comme adresse \""
|
. "a fait un transfert FTP sur le serveur ayant comme adresse \""
|
||||||
. $host . "\" avec le login \"" . $login . "\" "
|
. $host . "\" avec le login \"" . $login . "\" "
|
||||||
. "et pour repertoire de destination \""
|
. "et pour repertoire de destination \""
|
||||||
@@ -102,10 +101,10 @@ class set_exportftp extends set_export
|
|||||||
, ':pwd' => $password
|
, ':pwd' => $password
|
||||||
, ':passif' => ($passif == "1" ? "1" : "0")
|
, ':passif' => ($passif == "1" ? "1" : "0")
|
||||||
, ':destfolder' => $destfolder
|
, ':destfolder' => $destfolder
|
||||||
, ':sendermail' => $user_f->get_email()
|
, ':sendermail' => $this->app['phraseanet.user']->get_email()
|
||||||
, ':text_mail_receiver' => $text_mail_receiver
|
, ':text_mail_receiver' => $text_mail_receiver
|
||||||
, ':text_mail_sender' => $text_mail_sender
|
, ':text_mail_sender' => $text_mail_sender
|
||||||
, ':usr_id' => $user_f->get_id()
|
, ':usr_id' => $this->app['phraseanet.user']->get_id()
|
||||||
, ':foldertocreate' => $makedirectory
|
, ':foldertocreate' => $makedirectory
|
||||||
, ':logfile' => ( ! ! $logfile ? '1' : '0')
|
, ':logfile' => ( ! ! $logfile ? '1' : '0')
|
||||||
);
|
);
|
||||||
|
@@ -230,7 +230,6 @@ class set_order extends set_abstract
|
|||||||
throw new Exception_NotFound('unknown order ' . $id);
|
throw new Exception_NotFound('unknown order ' . $id);
|
||||||
|
|
||||||
$current_user = User_Adapter::getInstance($row['usr_id'], $app);
|
$current_user = User_Adapter::getInstance($row['usr_id'], $app);
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$this->id = $row['id'];
|
$this->id = $row['id'];
|
||||||
$this->user = $current_user;
|
$this->user = $current_user;
|
||||||
@@ -241,7 +240,7 @@ class set_order extends set_abstract
|
|||||||
$this->total = (int) $row['total'];
|
$this->total = (int) $row['total'];
|
||||||
$this->ssel_id = (int) $row['ssel_id'];
|
$this->ssel_id = (int) $row['ssel_id'];
|
||||||
|
|
||||||
$base_ids = array_keys($user->ACL()->get_granted_base(array('order_master')));
|
$base_ids = array_keys($app['phraseanet.user']->ACL()->get_granted_base(array('order_master')));
|
||||||
|
|
||||||
$sql = 'SELECT e.base_id, e.record_id, e.order_master_id, e.id, e.deny
|
$sql = 'SELECT e.base_id, e.record_id, e.order_master_id, e.id, e.deny
|
||||||
FROM order_elements e
|
FROM order_elements e
|
||||||
|
@@ -53,8 +53,6 @@ class set_selection extends set_abstract
|
|||||||
*/
|
*/
|
||||||
public function grep_authorized(Array $rights = array(), Array $sbas_rights = array())
|
public function grep_authorized(Array $rights = array(), Array $sbas_rights = array())
|
||||||
{
|
{
|
||||||
$user = $this->app['phraseanet.user'];
|
|
||||||
|
|
||||||
$to_remove = array();
|
$to_remove = array();
|
||||||
|
|
||||||
foreach ($this->elements as $id => $record) {
|
foreach ($this->elements as $id => $record) {
|
||||||
@@ -62,26 +60,26 @@ class set_selection extends set_abstract
|
|||||||
$sbas_id = $record->get_sbas_id();
|
$sbas_id = $record->get_sbas_id();
|
||||||
$record_id = $record->get_record_id();
|
$record_id = $record->get_record_id();
|
||||||
if ( ! $rights) {
|
if ( ! $rights) {
|
||||||
if ($user->ACL()->has_hd_grant($record)) {
|
if ($this->app['phraseanet.user']->ACL()->has_hd_grant($record)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->ACL()->has_preview_grant($record)) {
|
if ($this->app['phraseanet.user']->ACL()->has_preview_grant($record)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( ! $user->ACL()->has_access_to_base($base_id)) {
|
if ( ! $this->app['phraseanet.user']->ACL()->has_access_to_base($base_id)) {
|
||||||
$to_remove[] = $id;
|
$to_remove[] = $id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($rights as $right) {
|
foreach ($rights as $right) {
|
||||||
if ( ! $user->ACL()->has_right_on_base($base_id, $right)) {
|
if ( ! $this->app['phraseanet.user']->ACL()->has_right_on_base($base_id, $right)) {
|
||||||
$to_remove[] = $id;
|
$to_remove[] = $id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($sbas_rights as $right) {
|
foreach ($sbas_rights as $right) {
|
||||||
if ( ! $user->ACL()->has_right_on_sbas($sbas_id, $right)) {
|
if ( ! $this->app['phraseanet.user']->ACL()->has_right_on_sbas($sbas_id, $right)) {
|
||||||
$to_remove[] = $id;
|
$to_remove[] = $id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -93,8 +91,8 @@ class set_selection extends set_abstract
|
|||||||
|
|
||||||
$sql = 'SELECT record_id
|
$sql = 'SELECT record_id
|
||||||
FROM record
|
FROM record
|
||||||
WHERE ((status ^ ' . $user->ACL()->get_mask_xor($base_id) . ')
|
WHERE ((status ^ ' . $this->app['phraseanet.user']->ACL()->get_mask_xor($base_id) . ')
|
||||||
& ' . $user->ACL()->get_mask_and($base_id) . ')=0
|
& ' . $this->app['phraseanet.user']->ACL()->get_mask_and($base_id) . ')=0
|
||||||
AND record_id = :record_id';
|
AND record_id = :record_id';
|
||||||
|
|
||||||
$stmt = $connsbas->prepare($sql);
|
$stmt = $connsbas->prepare($sql);
|
||||||
|
@@ -310,10 +310,9 @@ class task_period_outofdate extends task_abstract
|
|||||||
// ====================================================================
|
// ====================================================================
|
||||||
public function getInterfaceHTML()
|
public function getInterfaceHTML()
|
||||||
{
|
{
|
||||||
$user = $this->dependencyContainer['phraseanet.user'];
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
$sbas_list = $user->ACL()->get_granted_sbas(array('bas_manage'));
|
$sbas_list = $this->dependencyContainer['phraseanet.user']->ACL()->get_granted_sbas(array('bas_manage'));
|
||||||
?>
|
?>
|
||||||
<form name="graphicForm" onsubmit="return(false);" method="post">
|
<form name="graphicForm" onsubmit="return(false);" method="post">
|
||||||
<?php echo _('task::outofdate:Base') ?> :
|
<?php echo _('task::outofdate:Base') ?> :
|
||||||
|
@@ -261,7 +261,6 @@ class task_period_workflow01 extends task_databoxAbstract
|
|||||||
|
|
||||||
public function getInterfaceHTML()
|
public function getInterfaceHTML()
|
||||||
{
|
{
|
||||||
$user = $this->dependencyContainer['phraseanet.user'];
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<form name="graphicForm" onsubmit="return(false);" method="post">
|
<form name="graphicForm" onsubmit="return(false);" method="post">
|
||||||
@@ -270,7 +269,7 @@ class task_period_workflow01 extends task_databoxAbstract
|
|||||||
<select onchange="chgsbas(this);setDirty();" name="sbas_id">
|
<select onchange="chgsbas(this);setDirty();" name="sbas_id">
|
||||||
<option value="">...</option>
|
<option value="">...</option>
|
||||||
<?php
|
<?php
|
||||||
$sbas_ids = $user->ACL()->get_granted_sbas(array('bas_manage'));
|
$sbas_ids = $this->dependencyContainer['phraseanet.user']->ACL()->get_granted_sbas(array('bas_manage'));
|
||||||
foreach ($sbas_ids as $databox) {
|
foreach ($sbas_ids as $databox) {
|
||||||
print('<option value="' . $databox->get_sbas_id() . '">' . p4string::MakeString($databox->get_viewname(), "form") . '</option>');
|
print('<option value="' . $databox->get_sbas_id() . '">' . p4string::MakeString($databox->get_viewname(), "form") . '</option>');
|
||||||
}
|
}
|
||||||
@@ -428,8 +427,6 @@ class task_period_workflow01 extends task_databoxAbstract
|
|||||||
{
|
{
|
||||||
$request = http_request::getInstance();
|
$request = http_request::getInstance();
|
||||||
|
|
||||||
$user = $this->dependencyContainer['phraseanet.user'];
|
|
||||||
|
|
||||||
$parm = $request->get_parms("bid");
|
$parm = $request->get_parms("bid");
|
||||||
|
|
||||||
phrasea::headers(200, true, 'text/json', 'UTF-8', false);
|
phrasea::headers(200, true, 'text/json', 'UTF-8', false);
|
||||||
@@ -463,7 +460,7 @@ class task_period_workflow01 extends task_databoxAbstract
|
|||||||
'label' => $s['labelon'] ? $s['labelon'] : $s['name']);
|
'label' => $s['labelon'] ? $s['labelon'] : $s['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$base_ids = $user->ACL()->get_granted_base(array(), array($sbas_id));
|
$base_ids = $this->dependencyContainer['phraseanet.user']->ACL()->get_granted_base(array(), array($sbas_id));
|
||||||
foreach ($base_ids as $collection) {
|
foreach ($base_ids as $collection) {
|
||||||
$retjs['collections'][] = array('id' => (string) ($collection->get_coll_id()), 'name' => $collection->get_name());
|
$retjs['collections'][] = array('id' => (string) ($collection->get_coll_id()), 'name' => $collection->get_name());
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,6 @@ use Alchemy\Phrasea\Application;
|
|||||||
require_once __DIR__ . "/../../lib/bootstrap.php";
|
require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||||
|
|
||||||
$app = new Application();
|
$app = new Application();
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
if ( ! isset($parm)) {
|
if ( ! isset($parm)) {
|
||||||
|
|
||||||
@@ -82,15 +81,14 @@ $tbases = array();
|
|||||||
|
|
||||||
$options = new searchEngine_options();
|
$options = new searchEngine_options();
|
||||||
|
|
||||||
$parm['bas'] = is_array($parm['bas']) ? $parm['bas'] : array_keys($user->ACL()->get_granted_base());
|
$parm['bas'] = is_array($parm['bas']) ? $parm['bas'] : array_keys($app['phraseanet.user']->ACL()->get_granted_base());
|
||||||
|
|
||||||
/* @var $user \User_Adapter */
|
if ($app['phraseanet.user']->ACL()->has_right('modifyrecord')) {
|
||||||
if ($user->ACL()->has_right('modifyrecord')) {
|
|
||||||
$options->set_business_fields(array());
|
$options->set_business_fields(array());
|
||||||
|
|
||||||
$BF = array();
|
$BF = array();
|
||||||
|
|
||||||
foreach ($user->ACL()->get_granted_base(array('canmodifrecord')) as $collection) {
|
foreach ($app['phraseanet.user']->ACL()->get_granted_base(array('canmodifrecord')) as $collection) {
|
||||||
if (count($parm['bas']) === 0 || in_array($collection->get_base_id(), $parm['bas'])) {
|
if (count($parm['bas']) === 0 || in_array($collection->get_base_id(), $parm['bas'])) {
|
||||||
$BF[] = $collection->get_base_id();
|
$BF[] = $collection->get_base_id();
|
||||||
}
|
}
|
||||||
@@ -100,7 +98,7 @@ if ($user->ACL()->has_right('modifyrecord')) {
|
|||||||
$options->set_business_fields(array());
|
$options->set_business_fields(array());
|
||||||
}
|
}
|
||||||
|
|
||||||
$options->set_bases($parm['bas'], $user->ACL());
|
$options->set_bases($parm['bas'], $app['phraseanet.user']->ACL());
|
||||||
if ( ! is_array($parm['infield']))
|
if ( ! is_array($parm['infield']))
|
||||||
$parm['infield'] = array();
|
$parm['infield'] = array();
|
||||||
|
|
||||||
@@ -151,7 +149,7 @@ $npages = $result->get_total_pages();
|
|||||||
|
|
||||||
$page = $result->get_current_page();
|
$page = $result->get_current_page();
|
||||||
|
|
||||||
$ACL = $user->ACL();
|
$ACL = $app['phraseanet.user']->ACL();
|
||||||
|
|
||||||
if ($app['phraseanet.registry']->get('GV_thesaurus')) {
|
if ($app['phraseanet.registry']->get('GV_thesaurus')) {
|
||||||
?>
|
?>
|
||||||
|
@@ -24,15 +24,14 @@ $Request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
|
|||||||
|
|
||||||
$nbNoview = 0;
|
$nbNoview = 0;
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
$ACL = $app['phraseanet.user']->ACL();
|
||||||
$ACL = $user->ACL();
|
|
||||||
|
|
||||||
$out = null;
|
$out = null;
|
||||||
|
|
||||||
if ($Request->get("act") == "DELIMG" && $Request->get("p0") != "") {
|
if ($Request->get("act") == "DELIMG" && $Request->get("p0") != "") {
|
||||||
$repository = $app['EM']->getRepository('\Entities\BasketElement');
|
$repository = $app['EM']->getRepository('\Entities\BasketElement');
|
||||||
/* @var $repository \Repositories\BasketElementRepository */
|
/* @var $repository \Repositories\BasketElementRepository */
|
||||||
$basket_element = $repository->findUserElement($Request->get('p0'), $user);
|
$basket_element = $repository->findUserElement($Request->get('p0'), $app['phraseanet.user']);
|
||||||
$app['EM']->remove($basket_element);
|
$app['EM']->remove($basket_element);
|
||||||
$app['EM']->flush();
|
$app['EM']->flush();
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,7 @@ if ($Request->get("act") == "DELIMG" && $Request->get("p0") != "") {
|
|||||||
if ($Request->get('act') == "ADDIMG" && ($Request->get("p0") != "" && $Request->get("p0") != null)) {
|
if ($Request->get('act') == "ADDIMG" && ($Request->get("p0") != "" && $Request->get("p0") != null)) {
|
||||||
$repository = $app['EM']->getRepository('\Entities\Basket');
|
$repository = $app['EM']->getRepository('\Entities\Basket');
|
||||||
/* @var $repository \Repositories\BasketRepository */
|
/* @var $repository \Repositories\BasketRepository */
|
||||||
$basket = $repository->findUserBasket($app, $Request->get('courChuId'), $user, true);
|
$basket = $repository->findUserBasket($app, $Request->get('courChuId'), $app['phraseanet.user'], true);
|
||||||
|
|
||||||
$sbas_id = $Request->get('sbas');
|
$sbas_id = $Request->get('sbas');
|
||||||
$record = new record_adapter($app, $sbas_id, $Request->get('p0'));
|
$record = new record_adapter($app, $sbas_id, $Request->get('p0'));
|
||||||
@@ -59,7 +58,7 @@ if ($Request->get('act') == "ADDIMG" && ($Request->get("p0") != "" && $Request->
|
|||||||
if ($Request->get('act') == "DELCHU" && ($Request->get("p0") != "" && $Request->get("p0") != null)) {
|
if ($Request->get('act') == "DELCHU" && ($Request->get("p0") != "" && $Request->get("p0") != null)) {
|
||||||
$repository = $app['EM']->getRepository('\Entities\Basket');
|
$repository = $app['EM']->getRepository('\Entities\Basket');
|
||||||
/* @var $repository \Repositories\BasketRepository */
|
/* @var $repository \Repositories\BasketRepository */
|
||||||
$basket = $repository->findUserBasket($app, $Request->get('courChuId'), $user, true);
|
$basket = $repository->findUserBasket($app, $Request->get('courChuId'), $app['phraseanet.user'], true);
|
||||||
|
|
||||||
$app['EM']->remove($basket);
|
$app['EM']->remove($basket);
|
||||||
$app['EM']->flush();
|
$app['EM']->flush();
|
||||||
@@ -72,7 +71,7 @@ $courChuId = $Request->get('courChuId');
|
|||||||
if ($Request->get('act') == "NEWCHU" && ($Request->get("p0") != "" && $Request->get("p0") != null)) {
|
if ($Request->get('act') == "NEWCHU" && ($Request->get("p0") != "" && $Request->get("p0") != null)) {
|
||||||
$basket = new \Entities\Basket();
|
$basket = new \Entities\Basket();
|
||||||
$basket->setName($Request->get('p0'));
|
$basket->setName($Request->get('p0'));
|
||||||
$basket->setOwner($user);
|
$basket->setOwner($app['phraseanet.user']);
|
||||||
|
|
||||||
$app['EM']->persist($basket);
|
$app['EM']->persist($basket);
|
||||||
$app['EM']->flush();
|
$app['EM']->flush();
|
||||||
@@ -82,7 +81,7 @@ if ($Request->get('act') == "NEWCHU" && ($Request->get("p0") != "" && $Request->
|
|||||||
|
|
||||||
$repository = $app['EM']->getRepository('\Entities\Basket');
|
$repository = $app['EM']->getRepository('\Entities\Basket');
|
||||||
/* @var $repository \Repositories\BasketRepository */
|
/* @var $repository \Repositories\BasketRepository */
|
||||||
$baskets = $repository->findActiveByUser($user);
|
$baskets = $repository->findActiveByUser($app['phraseanet.user']);
|
||||||
|
|
||||||
$out = "<table style='width:99%' class='baskIndicator' id='baskMainTable'><tr><td>";
|
$out = "<table style='width:99%' class='baskIndicator' id='baskMainTable'><tr><td>";
|
||||||
$out .= '<select id="chutier_name" name="chutier_name" onChange="chg_chu();" style="width:120px;">';
|
$out .= '<select id="chutier_name" name="chutier_name" onChange="chg_chu();" style="width:120px;">';
|
||||||
@@ -133,7 +132,7 @@ $out .= '</td><td style="width:40%">';
|
|||||||
|
|
||||||
$repository = $app['EM']->getRepository('\Entities\Basket');
|
$repository = $app['EM']->getRepository('\Entities\Basket');
|
||||||
/* @var $repository \Repositories\BasketRepository */
|
/* @var $repository \Repositories\BasketRepository */
|
||||||
$basket = $repository->findUserBasket($app, $courChuId, $user, true);
|
$basket = $repository->findUserBasket($app, $courChuId, $app['phraseanet.user'], true);
|
||||||
|
|
||||||
$jscriptnochu = $basket->getName() . " : " . sprintf(_('paniers:: %d documents dans le panier'), $basket->getElements()->count());
|
$jscriptnochu = $basket->getName() . " : " . sprintf(_('paniers:: %d documents dans le panier'), $basket->getElements()->count());
|
||||||
|
|
||||||
@@ -210,10 +209,10 @@ foreach ($basket->getElements() as $basket_element) {
|
|||||||
class="<?php echo $classSize ?> baskTips" src="<?php echo $thumbnail->get_url() ?>"><?php
|
class="<?php echo $classSize ?> baskTips" src="<?php echo $thumbnail->get_url() ?>"><?php
|
||||||
?></div><?php ?><div class="tools"><?php ?><div class="baskOneDel" onclick="evt_del_in_chutier('<?php echo $basket_element->getId() ?>');"
|
?></div><?php ?><div class="tools"><?php ?><div class="baskOneDel" onclick="evt_del_in_chutier('<?php echo $basket_element->getId() ?>');"
|
||||||
title="<?php echo _('action : supprimer') ?>"></div><?php
|
title="<?php echo _('action : supprimer') ?>"></div><?php
|
||||||
if ($user->ACL()->has_right_on_base($record->get_base_id(), 'candwnldhd') ||
|
if ($app['phraseanet.user']->ACL()->has_right_on_base($record->get_base_id(), 'candwnldhd') ||
|
||||||
$user->ACL()->has_right_on_base($record->get_base_id(), 'candwnldpreview') ||
|
$app['phraseanet.user']->ACL()->has_right_on_base($record->get_base_id(), 'candwnldpreview') ||
|
||||||
$user->ACL()->has_right_on_base($record->get_base_id(), 'cancmd') ||
|
$app['phraseanet.user']->ACL()->has_right_on_base($record->get_base_id(), 'cancmd') ||
|
||||||
$user->ACL()->has_preview_grant($record)) {
|
$app['phraseanet.user']->ACL()->has_preview_grant($record)) {
|
||||||
?><div class="baskOneDownload" onclick="evt_dwnl('<?php echo $record->get_sbas_id() ?>_<?php echo $record->get_record_id() ?>');" title="<?php echo _('action : exporter') ?>"></div><?php
|
?><div class="baskOneDownload" onclick="evt_dwnl('<?php echo $record->get_sbas_id() ?>_<?php echo $record->get_record_id() ?>');" title="<?php echo _('action : exporter') ?>"></div><?php
|
||||||
}
|
}
|
||||||
?></div><?php
|
?></div><?php
|
||||||
|
@@ -20,7 +20,6 @@ use Alchemy\Phrasea\Application;
|
|||||||
require_once __DIR__ . "/../../lib/bootstrap.php";
|
require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||||
|
|
||||||
$app = new Application();
|
$app = new Application();
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$lng = $app['locale'];
|
$lng = $app['locale'];
|
||||||
|
|
||||||
@@ -99,10 +98,10 @@ switch ($parm['action']) {
|
|||||||
$output = phrasea::getHome($app, 'PUBLI', 'client');
|
$output = phrasea::getHome($app, 'PUBLI', 'client');
|
||||||
break;
|
break;
|
||||||
case 'CSS':
|
case 'CSS':
|
||||||
$output = $user->setPrefs('css', $parm['color']);
|
$output = $app['phraseanet.user']->setPrefs('css', $parm['color']);
|
||||||
break;
|
break;
|
||||||
case 'BASK_STATUS':
|
case 'BASK_STATUS':
|
||||||
$output = $user->setPrefs('client_basket_status', $parm['mode']);
|
$output = $app['phraseanet.user']->setPrefs('client_basket_status', $parm['mode']);
|
||||||
break;
|
break;
|
||||||
case 'BASKUPDATE':
|
case 'BASKUPDATE':
|
||||||
$noview = 0;
|
$noview = 0;
|
||||||
@@ -110,7 +109,7 @@ switch ($parm['action']) {
|
|||||||
$repository = $app['EM']->getRepository('\Entities\Basket');
|
$repository = $app['EM']->getRepository('\Entities\Basket');
|
||||||
|
|
||||||
/* @var $repository \Repositories\BasketRepository */
|
/* @var $repository \Repositories\BasketRepository */
|
||||||
$baskets = $repository->findActiveByUser($user);
|
$baskets = $repository->findActiveByUser($app['phraseanet.user']);
|
||||||
|
|
||||||
foreach ($baskets as $basket) {
|
foreach ($baskets as $basket) {
|
||||||
if ( ! $basket->getIsRead())
|
if ( ! $basket->getIsRead())
|
||||||
|
@@ -17,12 +17,9 @@ use Alchemy\Phrasea\Application;
|
|||||||
*/
|
*/
|
||||||
$app = new Application();
|
$app = new Application();
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
$feeds = \Feed_Collection::load_all($app, $app['phraseanet.user']);
|
||||||
|
|
||||||
$feeds = \Feed_Collection::load_all($app, $user);
|
$th_size = $app['phraseanet.user']->getPrefs('images_size');
|
||||||
|
|
||||||
|
|
||||||
$th_size = $user->getPrefs('images_size');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div style="height:50px;" class="homePubTitleBox">
|
<div style="height:50px;" class="homePubTitleBox">
|
||||||
|
@@ -19,15 +19,13 @@ use Alchemy\Phrasea\Application;
|
|||||||
require_once __DIR__ . "/../../lib/bootstrap.php";
|
require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||||
$app = new Application();
|
$app = new Application();
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$request = http_request::getInstance();
|
$request = http_request::getInstance();
|
||||||
$parm = $request->get_parms("lst", "SSTTID", "story");
|
$parm = $request->get_parms("lst", "SSTTID", "story");
|
||||||
|
|
||||||
$gatekeeper = gatekeeper::getInstance($app);
|
$gatekeeper = gatekeeper::getInstance($app);
|
||||||
$gatekeeper->require_session();
|
$gatekeeper->require_session();
|
||||||
|
|
||||||
if ($app['phraseanet.registry']->get('GV_needAuth2DL') && $user->is_guest()) {
|
if ($app['phraseanet.registry']->get('GV_needAuth2DL') && $app['phraseanet.user']->is_guest()) {
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
parent.hideDwnl();
|
parent.hideDwnl();
|
||||||
@@ -39,13 +37,12 @@ if ($app['phraseanet.registry']->get('GV_needAuth2DL') && $user->is_guest()) {
|
|||||||
|
|
||||||
|
|
||||||
$download = new set_export($app, $parm['lst'], $parm['SSTTID'], $parm['story']);
|
$download = new set_export($app, $parm['lst'], $parm['SSTTID'], $parm['story']);
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
echo $app['twig']->render('common/dialog_export.html.twig', array(
|
echo $app['twig']->render('common/dialog_export.html.twig', array(
|
||||||
'download' => $download,
|
'download' => $download,
|
||||||
'ssttid' => $parm['SSTTID'],
|
'ssttid' => $parm['SSTTID'],
|
||||||
'lst' => $download->serialize_list(),
|
'lst' => $download->serialize_list(),
|
||||||
'user' => $user,
|
'user' => $app['phraseanet.user'],
|
||||||
'default_export_title' => $app['phraseanet.registry']->get('GV_default_export_title'),
|
'default_export_title' => $app['phraseanet.registry']->get('GV_default_export_title'),
|
||||||
'choose_export_title' => $app['phraseanet.registry']->get('GV_choose_export_title')
|
'choose_export_title' => $app['phraseanet.registry']->get('GV_choose_export_title')
|
||||||
));
|
));
|
||||||
|
@@ -33,9 +33,7 @@ $gatekeeper->require_session();
|
|||||||
|
|
||||||
$events_mngr = $app['events-manager'];
|
$events_mngr = $app['events-manager'];
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
$from = array('name' => $app['phraseanet.user']->get_display_name(), 'email' => $app['phraseanet.user']->get_email());
|
||||||
|
|
||||||
$from = array('name' => $user->get_display_name(), 'email' => $user->get_email());
|
|
||||||
|
|
||||||
$titre = $Request->get("type") == "title" ? : false;
|
$titre = $Request->get("type") == "title" ? : false;
|
||||||
|
|
||||||
@@ -88,7 +86,7 @@ if (count($dest) > 0 && $token) {
|
|||||||
$reading_confirm_to = false;
|
$reading_confirm_to = false;
|
||||||
|
|
||||||
if ($Request->get('reading_confirm') == '1') {
|
if ($Request->get('reading_confirm') == '1') {
|
||||||
$reading_confirm_to = $user->get_email();
|
$reading_confirm_to = $app['phraseanet.user']->get_email();
|
||||||
}
|
}
|
||||||
|
|
||||||
//BUILDING ZIP
|
//BUILDING ZIP
|
||||||
|
@@ -34,8 +34,6 @@ if ($app->isAuthenticated()) {
|
|||||||
die(p4string::jsonencode($ret));
|
die(p4string::jsonencode($ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$conn = $app['phraseanet.appbox']->get_connection();
|
$conn = $app['phraseanet.appbox']->get_connection();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -70,7 +68,7 @@ $ret['changed'] = array();
|
|||||||
$repository = $app['EM']->getRepository('\Entities\Basket');
|
$repository = $app['EM']->getRepository('\Entities\Basket');
|
||||||
|
|
||||||
/* @var $repository \Repositories\BasketRepository */
|
/* @var $repository \Repositories\BasketRepository */
|
||||||
$baskets = $repository->findUnreadActiveByUser($user);
|
$baskets = $repository->findUnreadActiveByUser($app['phraseanet.user']);
|
||||||
|
|
||||||
foreach ($baskets as $basket) {
|
foreach ($baskets as $basket) {
|
||||||
$ret['changed'][] = $basket->getId();
|
$ret['changed'][] = $basket->getId();
|
||||||
|
@@ -20,8 +20,6 @@ require_once __DIR__ . "/../../lib/bootstrap.php";
|
|||||||
$app = new Application();
|
$app = new Application();
|
||||||
phrasea::headers();
|
phrasea::headers();
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$request = http_request::getInstance();
|
$request = http_request::getInstance();
|
||||||
$parm = $request->get_parms(
|
$parm = $request->get_parms(
|
||||||
"act"
|
"act"
|
||||||
@@ -35,7 +33,7 @@ $parm = $request->get_parms(
|
|||||||
?>
|
?>
|
||||||
<html lang="<?php echo $app['locale.I18n']; ?>">
|
<html lang="<?php echo $app['locale.I18n']; ?>">
|
||||||
<head>
|
<head>
|
||||||
<link type="text/css" rel="stylesheet" href="/include/minify/f=skins/prod/<?php echo $user->getPrefs('css') ?>/prodcolor.css" />
|
<link type="text/css" rel="stylesheet" href="/include/minify/f=skins/prod/<?php echo $app['phraseanet.user']->getPrefs('css') ?>/prodcolor.css" />
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
@@ -23,8 +23,6 @@ phrasea::headers();
|
|||||||
$request = http_request::getInstance();
|
$request = http_request::getInstance();
|
||||||
$parm = $request->get_parms("ACT", "typelst");
|
$parm = $request->get_parms("ACT", "typelst");
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
if ($parm['ACT'] == 'SEND') {
|
if ($parm['ACT'] == 'SEND') {
|
||||||
$lst = $parm['typelst'];
|
$lst = $parm['typelst'];
|
||||||
|
|
||||||
@@ -47,7 +45,7 @@ if ($parm['ACT'] == 'SEND') {
|
|||||||
?>
|
?>
|
||||||
<html lang="<?php echo $app['locale.I18n']; ?>">
|
<html lang="<?php echo $app['locale.I18n']; ?>">
|
||||||
<head>
|
<head>
|
||||||
<link type="text/css" rel="stylesheet" href="/include/minify/f=skins/prod/<?php echo $user->getPrefs('css') ?>/prodcolor.css" />
|
<link type="text/css" rel="stylesheet" href="/include/minify/f=skins/prod/<?php echo $app['phraseanet.user']->getPrefs('css') ?>/prodcolor.css" />
|
||||||
</head>
|
</head>
|
||||||
<body onload="parent.hideDwnl();">
|
<body onload="parent.hideDwnl();">
|
||||||
<?php
|
<?php
|
||||||
|
@@ -26,12 +26,11 @@ phrasea::headers();
|
|||||||
$request = http_request::getInstance();
|
$request = http_request::getInstance();
|
||||||
$parm = $request->get_parms("act", "lst", "SSTTID", "story");
|
$parm = $request->get_parms("act", "lst", "SSTTID", "story");
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
?>
|
?>
|
||||||
<html lang="<?php echo $app['locale.I18n']; ?>">
|
<html lang="<?php echo $app['locale.I18n']; ?>">
|
||||||
<head>
|
<head>
|
||||||
<base target="_self">
|
<base target="_self">
|
||||||
<link type="text/css" rel="stylesheet" href="/include/minify/f=skins/common/main.css,include/jslibs/jquery-ui-1.8.17/css/dark-hive/jquery-ui-1.8.17.custom.css,skins/prod/<?php echo $user->getPrefs('css') ?>/prodcolor.css" />
|
<link type="text/css" rel="stylesheet" href="/include/minify/f=skins/common/main.css,include/jslibs/jquery-ui-1.8.17/css/dark-hive/jquery-ui-1.8.17.custom.css,skins/prod/<?php echo $app['phraseanet.user']->getPrefs('css') ?>/prodcolor.css" />
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
@@ -19,8 +19,6 @@ use Alchemy\Phrasea\Application;
|
|||||||
require_once __DIR__ . "/../../lib/bootstrap.php";
|
require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||||
$app = new Application();
|
$app = new Application();
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
$request = http_request::getInstance();
|
$request = http_request::getInstance();
|
||||||
@@ -39,15 +37,14 @@ switch ($action) {
|
|||||||
$options = new searchEngine_options();
|
$options = new searchEngine_options();
|
||||||
|
|
||||||
|
|
||||||
$parm['bas'] = is_array($parm['bas']) ? $parm['bas'] : array_keys($user->ACL()->get_granted_base());
|
$parm['bas'] = is_array($parm['bas']) ? $parm['bas'] : array_keys($app['phraseanet.user']->ACL()->get_granted_base());
|
||||||
|
|
||||||
/* @var $user \User_Adapter */
|
if ($app['phraseanet.user']->ACL()->has_right('modifyrecord')) {
|
||||||
if ($user->ACL()->has_right('modifyrecord')) {
|
|
||||||
$options->set_business_fields(array());
|
$options->set_business_fields(array());
|
||||||
|
|
||||||
$BF = array();
|
$BF = array();
|
||||||
|
|
||||||
foreach ($user->ACL()->get_granted_base(array('canmodifrecord')) as $collection) {
|
foreach ($app['phraseanet.user']->ACL()->get_granted_base(array('canmodifrecord')) as $collection) {
|
||||||
if (count($params['bases']) === 0 || in_array($collection->get_base_id(), $params['bases'])) {
|
if (count($params['bases']) === 0 || in_array($collection->get_base_id(), $params['bases'])) {
|
||||||
$BF[] = $collection->get_base_id();
|
$BF[] = $collection->get_base_id();
|
||||||
}
|
}
|
||||||
@@ -58,7 +55,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$options->set_bases($parm['bas'], $user->ACL());
|
$options->set_bases($parm['bas'], $app['phraseanet.user']->ACL());
|
||||||
if (!!is_array($parm['fields']))
|
if (!!is_array($parm['fields']))
|
||||||
$parm['fields'] = array();
|
$parm['fields'] = array();
|
||||||
$options->set_fields($parm['fields']);
|
$options->set_fields($parm['fields']);
|
||||||
@@ -82,7 +79,7 @@ switch ($action) {
|
|||||||
case 'CSS':
|
case 'CSS':
|
||||||
require ($app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/prodUtils.php');
|
require ($app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/prodUtils.php');
|
||||||
$parm = $request->get_parms('color');
|
$parm = $request->get_parms('color');
|
||||||
$output = $user->setPrefs('css', $parm['color']);
|
$output = $app['phraseanet.user']->setPrefs('css', $parm['color']);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'SAVETEMPPREF':
|
case 'SAVETEMPPREF':
|
||||||
|
@@ -23,14 +23,12 @@ phrasea::headers();
|
|||||||
$request = http_request::getInstance();
|
$request = http_request::getInstance();
|
||||||
$parm = $request->get_parms("bas", "rec");
|
$parm = $request->get_parms("bas", "rec");
|
||||||
|
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
$right = false;
|
$right = false;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<html lang="<?php echo $app['locale.I18n']; ?>">
|
<html lang="<?php echo $app['locale.I18n']; ?>">
|
||||||
<head>
|
<head>
|
||||||
<link type="text/css" rel="stylesheet" href="/include/minify/f=skins/common/main.css,include/jslibs/jquery-ui-1.8.17/css/ui-lightness/jquery-ui-1.8.17.custom.css,skins/prod/<?php echo $user->getPrefs('css') ?>/prodcolor.css" />
|
<link type="text/css" rel="stylesheet" href="/include/minify/f=skins/common/main.css,include/jslibs/jquery-ui-1.8.17/css/ui-lightness/jquery-ui-1.8.17.custom.css,skins/prod/<?php echo $app['phraseanet.user']->getPrefs('css') ?>/prodcolor.css" />
|
||||||
<script type="text/javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js"></script>
|
<script type="text/javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js"></script>
|
||||||
<script type="text/javascript" src="/include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min.js"></script>
|
<script type="text/javascript" src="/include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min.js"></script>
|
||||||
|
|
||||||
@@ -55,8 +53,8 @@ $right = false;
|
|||||||
<?php
|
<?php
|
||||||
$sbas_id = phrasea::sbasFromBas($app, $parm['bas']);
|
$sbas_id = phrasea::sbasFromBas($app, $parm['bas']);
|
||||||
$record = new record_adapter($app, $sbas_id, $parm['rec']);
|
$record = new record_adapter($app, $sbas_id, $parm['rec']);
|
||||||
$right = ($user->ACL()->has_right_on_sbas($sbas_id, 'bas_chupub')
|
$right = ($app['phraseanet.user']->ACL()->has_right_on_sbas($sbas_id, 'bas_chupub')
|
||||||
&& $user->ACL()->has_access_to_subdef($record, 'preview'));
|
&& $app['phraseanet.user']->ACL()->has_access_to_subdef($record, 'preview'));
|
||||||
|
|
||||||
if ( ! $right)
|
if ( ! $right)
|
||||||
exit('ERROR<br><input class="input-button" type="button" value="' . _('boutton::fermer') . '" onclick="parent.hideDwnl();" /> </body></html>');
|
exit('ERROR<br><input class="input-button" type="button" value="' . _('boutton::fermer') . '" onclick="parent.hideDwnl();" /> </body></html>');
|
||||||
|
@@ -20,9 +20,8 @@ use Alchemy\Phrasea\Application;
|
|||||||
require_once __DIR__ . "/../../lib/bootstrap.php";
|
require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||||
|
|
||||||
$app = new Application();
|
$app = new Application();
|
||||||
$user = $app['phraseanet.user'];
|
|
||||||
|
|
||||||
if ( ! $user->ACL()->has_right('report'))
|
if ( ! $app['phraseanet.user']->ACL()->has_right('report'))
|
||||||
phrasea::headers(403);
|
phrasea::headers(403);
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ $dmin = isset($_POST['dmin']) ? $_POST['dmin'] : false;
|
|||||||
$dmax = isset($_POST['dmax']) ? $_POST['dmax'] : false;
|
$dmax = isset($_POST['dmax']) ? $_POST['dmax'] : false;
|
||||||
///////Construct dashboard
|
///////Construct dashboard
|
||||||
try {
|
try {
|
||||||
$dashboard = new module_report_dashboard($app, $user, $sbasid);
|
$dashboard = new module_report_dashboard($app, $app['phraseanet.user'], $sbasid);
|
||||||
|
|
||||||
if ($dmin && $dmax) {
|
if ($dmin && $dmax) {
|
||||||
$dashboard->setDate($dmin, $dmax);
|
$dashboard->setDate($dmin, $dmax);
|
||||||
|
@@ -27,8 +27,7 @@ phrasea::headers();
|
|||||||
User_Adapter::updateClientInfos($app, 4);
|
User_Adapter::updateClientInfos($app, 4);
|
||||||
|
|
||||||
///////Construct dashboard
|
///////Construct dashboard
|
||||||
$user = $app['phraseanet.user'];
|
$dashboard = new module_report_dashboard($app, $app['phraseanet.user']);
|
||||||
$dashboard = new module_report_dashboard($app, $user);
|
|
||||||
$dashboard->execute();
|
$dashboard->execute();
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user