From: <lph...@us...> - 2009-07-27 20:11:58
|
Revision: 20363 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=20363&view=rev Author: lphuberdeau Date: 2009-07-27 20:11:51 +0000 (Mon, 27 Jul 2009) Log Message: ----------- [MOD] Ignore managed categories when unspecified for compatibility reasons Modified Paths: -------------- branches/experimental/perms-take2/lib/core/lib/Category/Manipulator.php branches/experimental/perms-take2/lib/core/test/Category/ManipulatorTest.php Modified: branches/experimental/perms-take2/lib/core/lib/Category/Manipulator.php =================================================================== --- branches/experimental/perms-take2/lib/core/lib/Category/Manipulator.php 2009-07-27 20:02:19 UTC (rev 20362) +++ branches/experimental/perms-take2/lib/core/lib/Category/Manipulator.php 2009-07-27 20:11:51 UTC (rev 20363) @@ -77,8 +77,10 @@ $categories = $this->managed; Perms::bulk( array( 'type' => 'category' ), 'object', $categories ); - $this->current = array_intersect( $this->current, $this->managed ); - $this->new = array_intersect( $this->new, $this->new ); + if( $this->managed ) { + $this->current = array_intersect( $this->current, $this->managed ); + $this->new = array_intersect( $this->new, $this->new ); + } $this->prepared = true; } Modified: branches/experimental/perms-take2/lib/core/test/Category/ManipulatorTest.php =================================================================== --- branches/experimental/perms-take2/lib/core/test/Category/ManipulatorTest.php 2009-07-27 20:02:19 UTC (rev 20362) +++ branches/experimental/perms-take2/lib/core/test/Category/ManipulatorTest.php 2009-07-27 20:11:51 UTC (rev 20363) @@ -19,6 +19,22 @@ $this->assertEquals( array( 3, 7 ), $manip->getRemovedCategories() ); } + function testManipulationWithoutSpecifyingManaged() { + $perms = new Perms; + $perms->setResolverFactories( array( + new Perms_ResolverFactory_StaticFactory( 'root', new Perms_Resolver_Default( true ) ), + ) ); + Perms::set( $perms ); + + $manip = new Category_Manipulator( 'wiki page', 'Hello World' ); + $manip->setCurrentCategories( array( 1, 2, 3, 7 ) ); + + $manip->setNewCategories( array( 1, 2, 4 ) ); + + $this->assertEquals( array( 4 ), $manip->getAddedCategories() ); + $this->assertEquals( array( 3, 7 ), $manip->getRemovedCategories() ); + } + function testLimitationOnRange() { $perms = new Perms; $perms->setResolverFactories( array( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |