[Security][Acl] CS fix for commit: 3c3a90b9e5

This commit is contained in:
Joseph Bielawski 2013-01-07 09:53:09 +01:00
parent 3c3a90b9e5
commit d570dbe545

View File

@ -257,47 +257,43 @@ SELECTCLAUSE;
INNER JOIN {$this->options['oid_ancestors_table_name']} a ON a.object_identity_id = o.id INNER JOIN {$this->options['oid_ancestors_table_name']} a ON a.object_identity_id = o.id
WHERE ( WHERE (
SELECTCLAUSE; SELECTCLAUSE;
$types = array(); $types = array();
for ($i=0,$c=count($batch); $i<$c; $i++) { $count = count($batch);
if(!isset($types[$batch[$i]->getType()])) { for ($i = 0; $i < $count; $i++) {
$types[$batch[$i]->getType()] = true; if (!isset($types[$batch[$i]->getType()])) {
if(count($batch) > 1) { $types[$batch[$i]->getType()] = true;
break; if ($count > 1) {
} break;
} }
}
} }
if(count($types) === 1) { if (1 === count($types)) {
$ids = array();
$where = '(o.object_identifier IN (%s) AND c.class_type = %s)'; for ($i = 0; $i < $count; $i++) {
$ids = array(); $ids[] = $this->connection->quote($batch[$i]->getIdentifier());
for ($i=0,$c=count($batch); $i<$c; $i++) { }
$ids[] = $this->connection->quote($batch[$i]->getIdentifier());
} $sql .= sprintf(
'(o.object_identifier IN (%s) AND c.class_type = %s)',
$sql .= sprintf( implode(',', $ids),
$where, $this->connection->quote($batch[0]->getType())
implode(',', $ids), );
$this->connection->quote($batch[0]->getType())
);
} else { } else {
$where = '(o.object_identifier = %s AND c.class_type = %s)';
$where = '(o.object_identifier = %s AND c.class_type = %s)'; for ($i = 0; $i < $count; $i++) {
for ($i=0,$c=count($batch); $i<$c; $i++) { $sql .= sprintf(
$sql .= sprintf( $where,
$where, $this->connection->quote($batch[$i]->getIdentifier()),
$this->connection->quote($batch[$i]->getIdentifier()), $this->connection->quote($batch[$i]->getType())
$this->connection->quote($batch[$i]->getType()) );
);
if ($i+1 < $count) {
if ($i+1 < $c) { $sql .= ' OR ';
$sql .= ' OR '; }
} }
}
} }
$sql .= ')'; $sql .= ')';
@ -445,7 +441,7 @@ QUERY;
* @param array $oidLookup * @param array $oidLookup
* *
* @return \SplObjectStorage mapping object identities to ACL instances * @return \SplObjectStorage mapping object identities to ACL instances
* *
* @throws AclNotFoundException * @throws AclNotFoundException
*/ */
private function lookupObjectIdentities(array $batch, array $sids, array $oidLookup) private function lookupObjectIdentities(array $batch, array $sids, array $oidLookup)