mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53:15 +00:00
Port PHRAS-1593
This commit is contained in:
@@ -47,10 +47,22 @@ class Share implements ControllerProviderInterface, ServiceProviderInterface
|
||||
|
||||
$controllers->get('/record/{base_id}/{record_id}/', 'controller.prod.share:shareRecord')
|
||||
->before(function (Request $request) use ($app, $firewall) {
|
||||
$firewall->requireRightOnSbas(
|
||||
\phrasea::sbasFromBas($app, $request->attributes->get('base_id')),
|
||||
\ACL::BAS_CHUPUB
|
||||
);
|
||||
$socialTools = $app['conf']->get(['registry', 'actions', 'social-tools']);
|
||||
if($socialTools === "all") {
|
||||
return;
|
||||
}
|
||||
elseif($socialTools === "none") {
|
||||
$app->abort(403, 'social tools disabled');
|
||||
}
|
||||
elseif($socialTools === "publishers") {
|
||||
$firewall->requireRightOnSbas(
|
||||
\phrasea::sbasFromBas($app, $request->attributes->get('base_id')),
|
||||
\ACL::BAS_CHUPUB
|
||||
);
|
||||
}
|
||||
else {
|
||||
throw new \Exception("bad value \"" . $socialTools . "\" for social tools");
|
||||
}
|
||||
})
|
||||
->bind('share_record');
|
||||
|
||||
|
Reference in New Issue
Block a user