Remove user variable assignment

This commit is contained in:
Romain Neutron
2012-09-28 17:56:00 +02:00
parent 87c00ee4fb
commit 0565bce475
65 changed files with 274 additions and 509 deletions

View File

@@ -53,8 +53,6 @@ class set_selection extends set_abstract
*/
public function grep_authorized(Array $rights = array(), Array $sbas_rights = array())
{
$user = $this->app['phraseanet.user'];
$to_remove = array();
foreach ($this->elements as $id => $record) {
@@ -62,26 +60,26 @@ class set_selection extends set_abstract
$sbas_id = $record->get_sbas_id();
$record_id = $record->get_record_id();
if ( ! $rights) {
if ($user->ACL()->has_hd_grant($record)) {
if ($this->app['phraseanet.user']->ACL()->has_hd_grant($record)) {
continue;
}
if ($user->ACL()->has_preview_grant($record)) {
if ($this->app['phraseanet.user']->ACL()->has_preview_grant($record)) {
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;
continue;
}
} else {
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;
continue;
}
}
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;
continue;
}
@@ -93,8 +91,8 @@ class set_selection extends set_abstract
$sql = 'SELECT record_id
FROM record
WHERE ((status ^ ' . $user->ACL()->get_mask_xor($base_id) . ')
& ' . $user->ACL()->get_mask_and($base_id) . ')=0
WHERE ((status ^ ' . $this->app['phraseanet.user']->ACL()->get_mask_xor($base_id) . ')
& ' . $this->app['phraseanet.user']->ACL()->get_mask_and($base_id) . ')=0
AND record_id = :record_id';
$stmt = $connsbas->prepare($sql);