Add AuthenticationServiceProvider

This commit is contained in:
Romain Neutron
2013-02-15 11:08:05 +01:00
parent f5c5aebe22
commit d2bc4f4a23
117 changed files with 610 additions and 535 deletions

View File

@@ -623,15 +623,15 @@ class SearchEngineOptions
$bas = array_map(function($base_id) use ($app) {
return \collection::get_from_base_id($app, $base_id);
}, $request->get('bases'));
} elseif (!$app->isAuthenticated()) {
} elseif (!$app['authentication']->isAuthenticated()) {
$bas = $app->getOpenCollections();
} else {
$bas = $app['phraseanet.user']->ACL()->get_granted_base();
$bas = $app['authentication']->getUser()->ACL()->get_granted_base();
}
$bas = array_filter($bas, function($collection) use ($app) {
if ($app->isAuthenticated()) {
return $app['phraseanet.user']->ACL()->has_right_on_base($collection->get_base_id(), 'canmodifrecord');
if ($app['authentication']->isAuthenticated()) {
return $app['authentication']->getUser()->ACL()->has_right_on_base($collection->get_base_id(), 'canmodifrecord');
} else {
return in_array($collection, $app->getOpenCollections());
}
@@ -645,9 +645,9 @@ class SearchEngineOptions
}
}
if ($app->isAuthenticated() && $app['phraseanet.user']->ACL()->has_right('modifyrecord')) {
if ($app['authentication']->isAuthenticated() && $app['authentication']->getUser()->ACL()->has_right('modifyrecord')) {
$BF = array_filter($bas, function($collection) use ($app) {
return $app['phraseanet.user']->ACL()->has_right_on_base($collection->get_base_id(), 'canmodifrecord');
return $app['authentication']->getUser()->ACL()->has_right_on_base($collection->get_base_id(), 'canmodifrecord');
});
$options->allowBusinessFieldsOn($BF);