@@ -39,9 +39,9 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
39
39
/**
40
40
* {@inheritDoc}
41
41
*/
42
- public function __construct (Connection $ connection , PermissionGrantingStrategyInterface $ permissionGrantingStrategy , array $ options , AclCacheInterface $ aclCache = null )
42
+ public function __construct (Connection $ connection , PermissionGrantingStrategyInterface $ permissionGrantingStrategy , array $ options , AclCacheInterface $ cache = null )
43
43
{
44
- parent ::__construct ($ connection , $ permissionGrantingStrategy , $ options , $ aclCache );
44
+ parent ::__construct ($ connection , $ permissionGrantingStrategy , $ options , $ cache );
45
45
46
46
$ this ->propertyChanges = new \SplObjectStorage ();
47
47
}
@@ -104,8 +104,8 @@ public function deleteAcl(ObjectIdentityInterface $oid)
104
104
}
105
105
106
106
// evict the ACL from any caches
107
- if (null !== $ this ->aclCache ) {
108
- $ this ->aclCache ->evictFromCacheByIdentity ($ oid );
107
+ if (null !== $ this ->cache ) {
108
+ $ this ->cache ->evictFromCacheByIdentity ($ oid );
109
109
}
110
110
}
111
111
@@ -312,110 +312,25 @@ public function updateAcl(MutableAclInterface $acl)
312
312
313
313
$ this ->propertyChanges ->offsetSet ($ acl , array ());
314
314
315
- if (null !== $ this ->aclCache ) {
315
+ if (null !== $ this ->cache ) {
316
316
if (count ($ sharedPropertyChanges ) > 0 ) {
317
317
// FIXME: Currently, there is no easy way to clear the cache for ACLs
318
318
// of a certain type.
10000
The problem here is that we need to make
319
319
// sure to clear the cache of all child ACLs as well, and these
320
320
// child ACLs might be of a different class type.
321
- $ this ->aclCache ->clearCache ();
321
+ $ this ->cache ->clearCache ();
322
322
} else {
323
323
// if there are no shared property changes, it's sufficient to just delete
324
324
// the cache for this ACL
325
- $ this ->aclCache ->evictFromCacheByIdentity ($ acl ->getObjectIdentity ());
325
+ $ this ->cache ->evictFromCacheByIdentity ($ acl ->getObjectIdentity ());
326
326
327
327
foreach ($ this ->findChildren ($ acl ->getObjectIdentity ()) as $ childOid ) {
328
- $ this ->aclCache ->evictFromCacheByIdentity ($ childOid );
328
+ $ this ->cache ->evictFromCacheByIdentity ($ childOid );
329
329
}
330
330
}
331
331
}
332
332
}
333
333
334
- /**
335
- * Creates the ACL for the passed object identity
336
- *
337
- * @param ObjectIdentityInterface $oid
338
- * @return void
339
- */
340
- protected function createObjectIdentity (ObjectIdentityInterface $ oid )
341
- {
342
- $ classId = $ this ->createOrRetrieveClassId ($ oid ->getType ());
343
-
344
- $ this ->connection ->executeQuery ($ this ->getInsertObjectIdentitySql ($ oid ->getIdentifier (), $ classId , true ));
345
- }
346
-
347
- /**
348
- * Returns the primary key for the passed class type.
349
- *
350
- * If the type does not yet exist in the database, it will be created.
351
- *
352
- * @param string $classType
353
- * @return integer
354
- */
355
- protected function createOrRetrieveClassId ($ classType )
356
- {
357
- if (false !== $ id = $ this ->connection ->executeQuery ($ this ->getSelectClassIdSql ($ classType ))->fetchColumn ()) {
358
- return $ id ;
359
- }
360
-
361
- $ this ->connection ->executeQuery ($ this ->getInsertClassSql ($ classType ));
362
-
363
- return $ this ->connection ->executeQuery ($ this ->getSelectClassIdSql ($ classType ))->fetchColumn ();
364
- }
365
-
366
- /**
367
- * Returns the primary key for the passed security identity.
368
- *
369
- * If the security identity does not yet exist in the database, it will be
370
- * created.
371
- *
372
- * @param SecurityIdentityInterface $sid
373
- * @return integer
374
- */
375
- protected function createOrRetrieveSecurityIdentityId (SecurityIdentityInterface $ sid )
376
- {
377
- if (false !== $ id = $ this ->connection ->executeQuery ($ this ->getSelectSecurityIdentityIdSql ($ sid ))->fetchColumn ()) {
378
- return $ id ;
379
- }
380
-
381
- $ this ->connection ->executeQuery ($ this ->getInsertSecurityIdentitySql ($ sid ));
382
-
383
- return $ this ->connection ->executeQuery ($ this ->getSelectSecurityIdentityIdSql ($ sid ))->fetchColumn ();
384
- }
385
-
386
- /**
387
- * Deletes all ACEs for the given object identity primary key.
388
- *
389
- * @param integer $oidPK
390
- * @return void
391
- */
392
- protected function deleteAccessControlEntries ($ oidPK )
393
- {
394
- $ this ->connection ->executeQuery ($ this ->getDeleteAccessControlEntriesSql ($ oidPK ));
395
- }
396
-
397
- /**
398
- * Deletes the object identity from the database.
399
- *
400
- * @param integer $pk
401
- * @return void
402
- */
403
- protected function deleteObjectIdentity ($ pk )
404
- {
405
- $ this ->connection ->executeQuery ($ this ->getDeleteObjectIdentitySql ($ pk ));
406
- }
407
-
408
- /**
409
- * Deletes all entries from the relations table from the database.
410
- *
411
- * @param integer $pk
412
- * @return void
413
- */
414
- protected function deleteObjectIdentityRelations ($ pk )
415
- {
416
- $ this ->connection ->executeQuery ($ this ->getDeleteObjectIdentityRelationsSql ($ pk ));
417
- }
418
-
419
334
/**
420
335
* Constructs the SQL for deleting access control entries.
421
336
*
@@ -720,6 +635,91 @@ protected function getUpdateAccessControlEntrySql($pk, array $sets)
720
635
);
721
636
}
722
637
638
+ /**
639
+ * Creates the ACL for the passed object identity
640
+ *
641
+ * @param ObjectIdentityInterface $oid
642
+ * @return void
643
+ */
644
+ private function createObjectIdentity (ObjectIdentityInterface $ oid )
645
+ {
646
+ $ classId = $ this ->createOrRetrieveClassId ($ oid ->getType ());
647
+
648
+ $ this ->connection ->executeQuery ($ this ->getInsertObjectIdentitySql ($ oid ->getIdentifier (), $ classId , true ));
649
+ }
650
+
651
+ /**
652
+ * Returns the primary key for the passed class type.
653
+ *
654
+ * If the type does not yet exist in the database, it will be created.
655
+ *
656
+ * @param string $classType
657
+ * @return integer
658
+ */
659
+ private function createOrRetrieveClassId ($ classType )
660
+ {
661
+ if (false !== $ id = $ this ->connection ->executeQuery ($ this ->getSelectClassIdSql ($ classType ))->fetchColumn ()) {
662
+ return $ id ;
663
+ }
664
+
665
+ $ this ->connection ->executeQuery ($ this ->getInsertClassSql ($ classType ));
666
+
667
+ return $ this ->connection ->executeQuery ($ this ->getSelectClassIdSql ($ classType ))->fetchColumn ();
668
+ }
669
+
670
+ /**
671
+ * Returns the primary key for the passed security identity.
672
+ *
673
+ * If the security identity does not yet exist in the database, it will be
674
+ * created.
675
+ *
676
+ * @param SecurityIdentityInterface $sid
677
+ * @return integer
678
+ */
679
+ private function createOrRetrieveSecurityIdentityId (SecurityIdentityInterface $ sid )
680
+ {
681
+ if (false !== $ id = $ this ->connection ->executeQuery ($ this ->getSelectSecurityIdentityIdSql ($ sid ))->fetchColumn ()) {
682
+ return $ id ;
683
+ }
684
+
685
+ $ this ->connection ->executeQuery ($ this ->getInsertSecurityIdentitySql ($ sid ));
686
+
687
+ return $ this ->connection ->executeQuery ($ this ->getSelectSecurityIdentityIdSql ($ sid ))->fetchColumn ();
688
+ }
689
+
690
+ /**
691
+ * Deletes all ACEs for the given object identity primary key.
692
+ *
693
+ * @param integer $oidPK
694
+ * @return void
695
+ */
696
+ private function deleteAccessControlEntries ($ oidPK )
697
+ {
698
+ $ this ->connection ->executeQuery ($ this ->getDeleteAccessControlEntriesSql ($ oidPK ));
699
+ }
700
+
701
+ /**
702
+ * Deletes the object identity from the database.
703
+ *
704
+ * @param integer $pk
705
+ * @return void
706
+ */
707
+ private function deleteObjectIdentity ($ pk )
708
+ {
709
+ $ this ->connection ->executeQuery ($ this ->getDeleteObjectIdentitySql ($ pk ));
710
+ }
711
+
712
+ /**
713
+ * Deletes all entries from the relations table from the database.
714
+ *
715
+ * @param integer $pk
716
+ * @return void
717
+ */
718
+ private function deleteObjectIdentityRelations ($ pk )
719
+ {
720
+ $ this ->connection ->executeQuery ($ this ->getDeleteObjectIdentityRelationsSql ($ pk ));
721
+ }
722
+
723
723
/**
724
724
* This regenerates the ancestor table which is used for fast read access.
725
725
*
0 commit comments