$this->setUserPerm( null );
$this->assertEquals( $check[$action][0],
$this->title->getUserPermissionsErrors( $action, $this->user, true ) );
+ $this->assertEquals( $check[$action][0],
+ $this->title->getUserPermissionsErrors( $action, $this->user, 'full' ) );
+ $this->assertEquals( $check[$action][0],
+ $this->title->getUserPermissionsErrors( $action, $this->user, 'secure' ) );
global $wgGroupPermissions;
$old = $wgGroupPermissions;
$this->assertEquals( $check[$action][1],
$this->title->getUserPermissionsErrors( $action, $this->user, true ) );
+ $this->assertEquals( $check[$action][1],
+ $this->title->getUserPermissionsErrors( $action, $this->user, 'full' ) );
+ $this->assertEquals( $check[$action][1],
+ $this->title->getUserPermissionsErrors( $action, $this->user, 'secure' ) );
$wgGroupPermissions = $old;
$this->setUserPerm( $action );
$this->assertEquals( $check[$action][2],
$this->title->getUserPermissionsErrors( $action, $this->user, true ) );
+ $this->assertEquals( $check[$action][2],
+ $this->title->getUserPermissionsErrors( $action, $this->user, 'full' ) );
+ $this->assertEquals( $check[$action][2],
+ $this->title->getUserPermissionsErrors( $action, $this->user, 'secure' ) );
$this->setUserPerm( $action );
$this->assertEquals( $check[$action][3],
$this->setTitle( NS_USER );
$this->setUserPerm( '' );
- $this->assertEquals( array( array( 'badaccess-group0' ), array( 'namespaceprotected', 'User' ) ),
+ $this->assertEquals( array( array( 'badaccess-group0' ),
+ array( 'namespaceprotected', 'User', 'bogus' ) ),
$this->title->getUserPermissionsErrors( 'bogus', $this->user ) );
$this->setTitle( NS_MEDIAWIKI );
$this->setUserPerm( 'bogus' );
- $this->assertEquals( array( array( 'protectedinterface' ) ),
+ $this->assertEquals( array( array( 'protectedinterface', 'bogus' ) ),
$this->title->getUserPermissionsErrors( 'bogus', $this->user ) );
$this->setTitle( NS_MEDIAWIKI );
$this->setUserPerm( 'bogus' );
- $this->assertEquals( array( array( 'protectedinterface' ) ),
+ $this->assertEquals( array( array( 'protectedinterface', 'bogus' ) ),
$this->title->getUserPermissionsErrors( 'bogus', $this->user ) );
$wgNamespaceProtection = null;
$this->setTitle( NS_USER, $this->userName . '/test.js' );
$this->runCSSandJSPermissions(
- array( array( 'badaccess-group0' ), array( 'mycustomjsprotected' ) ),
- array( array( 'badaccess-group0' ), array( 'mycustomjsprotected' ) ),
+ array( array( 'badaccess-group0' ), array( 'mycustomjsprotected', 'bogus' ) ),
+ array( array( 'badaccess-group0' ), array( 'mycustomjsprotected', 'bogus' ) ),
array( array( 'badaccess-group0' ) ),
- array( array( 'badaccess-group0' ), array( 'mycustomjsprotected' ) ),
+ array( array( 'badaccess-group0' ), array( 'mycustomjsprotected', 'bogus' ) ),
array( array( 'badaccess-group0' ) )
);
$this->setTitle( NS_USER, $this->userName . '/test.css' );
$this->runCSSandJSPermissions(
- array( array( 'badaccess-group0' ), array( 'mycustomcssprotected' ) ),
+ array( array( 'badaccess-group0' ), array( 'mycustomcssprotected', 'bogus' ) ),
array( array( 'badaccess-group0' ) ),
- array( array( 'badaccess-group0' ), array( 'mycustomcssprotected' ) ),
+ array( array( 'badaccess-group0' ), array( 'mycustomcssprotected', 'bogus' ) ),
array( array( 'badaccess-group0' ) ),
- array( array( 'badaccess-group0' ), array( 'mycustomcssprotected' ) )
+ array( array( 'badaccess-group0' ), array( 'mycustomcssprotected', 'bogus' ) )
);
$this->setTitle( NS_USER, $this->altUserName . '/test.js' );
$this->runCSSandJSPermissions(
- array( array( 'badaccess-group0' ), array( 'customjsprotected' ) ),
- array( array( 'badaccess-group0' ), array( 'customjsprotected' ) ),
- array( array( 'badaccess-group0' ), array( 'customjsprotected' ) ),
- array( array( 'badaccess-group0' ), array( 'customjsprotected' ) ),
+ array( array( 'badaccess-group0' ), array( 'customjsprotected', 'bogus' ) ),
+ array( array( 'badaccess-group0' ), array( 'customjsprotected', 'bogus' ) ),
+ array( array( 'badaccess-group0' ), array( 'customjsprotected', 'bogus' ) ),
+ array( array( 'badaccess-group0' ), array( 'customjsprotected', 'bogus' ) ),
array( array( 'badaccess-group0' ) )
);
$this->setTitle( NS_USER, $this->altUserName . '/test.css' );
$this->runCSSandJSPermissions(
- array( array( 'badaccess-group0' ), array( 'customcssprotected' ) ),
- array( array( 'badaccess-group0' ), array( 'customcssprotected' ) ),
- array( array( 'badaccess-group0' ), array( 'customcssprotected' ) ),
+ array( array( 'badaccess-group0' ), array( 'customcssprotected', 'bogus' ) ),
+ array( array( 'badaccess-group0' ), array( 'customcssprotected', 'bogus' ) ),
+ array( array( 'badaccess-group0' ), array( 'customcssprotected', 'bogus' ) ),
array( array( 'badaccess-group0' ) ),
- array( array( 'badaccess-group0' ), array( 'customcssprotected' ) )
+ array( array( 'badaccess-group0' ), array( 'customcssprotected', 'bogus' ) )
);
$this->setTitle( NS_USER, $this->altUserName . '/tempo' );
"bogus" => array( 'bogus', "sysop", "protect", "" ) );
$this->assertEquals( array( array( 'badaccess-group0' ),
- array( 'protectedpagetext', 'bogus' ),
- array( 'protectedpagetext', 'editprotected' ),
- array( 'protectedpagetext', 'protect' ) ),
+ array( 'protectedpagetext', 'bogus', 'bogus' ),
+ array( 'protectedpagetext', 'editprotected', 'bogus' ),
+ array( 'protectedpagetext', 'protect', 'bogus' ) ),
$this->title->getUserPermissionsErrors( 'bogus',
$this->user ) );
- $this->assertEquals( array( array( 'protectedpagetext', 'bogus' ),
- array( 'protectedpagetext', 'editprotected' ),
- array( 'protectedpagetext', 'protect' ) ),
+ $this->assertEquals( array( array( 'protectedpagetext', 'bogus', 'edit' ),
+ array( 'protectedpagetext', 'editprotected', 'edit' ),
+ array( 'protectedpagetext', 'protect', 'edit' ) ),
$this->title->getUserPermissionsErrors( 'edit',
$this->user ) );
$this->setUserPerm( "" );
$this->assertEquals( array( array( 'badaccess-group0' ),
- array( 'protectedpagetext', 'bogus' ),
- array( 'protectedpagetext', 'editprotected' ),
- array( 'protectedpagetext', 'protect' ) ),
+ array( 'protectedpagetext', 'bogus', 'bogus' ),
+ array( 'protectedpagetext', 'editprotected', 'bogus' ),
+ array( 'protectedpagetext', 'protect', 'bogus' ) ),
$this->title->getUserPermissionsErrors( 'bogus',
$this->user ) );
$this->assertEquals( array( array( 'badaccess-groups', "*, [[$prefix:Users|Users]]", 2 ),
- array( 'protectedpagetext', 'bogus' ),
- array( 'protectedpagetext', 'editprotected' ),
- array( 'protectedpagetext', 'protect' ) ),
+ array( 'protectedpagetext', 'bogus', 'edit' ),
+ array( 'protectedpagetext', 'editprotected', 'edit' ),
+ array( 'protectedpagetext', 'protect', 'edit' ) ),
$this->title->getUserPermissionsErrors( 'edit',
$this->user ) );
$this->setUserPerm( array( "edit", "editprotected" ) );
$this->assertEquals( array( array( 'badaccess-group0' ),
- array( 'protectedpagetext', 'bogus' ),
- array( 'protectedpagetext', 'protect' ) ),
+ array( 'protectedpagetext', 'bogus', 'bogus' ),
+ array( 'protectedpagetext', 'protect', 'bogus' ) ),
$this->title->getUserPermissionsErrors( 'bogus',
$this->user ) );
$this->assertEquals( array(
- array( 'protectedpagetext', 'bogus' ),
- array( 'protectedpagetext', 'protect' ) ),
+ array( 'protectedpagetext', 'bogus', 'edit' ),
+ array( 'protectedpagetext', 'protect', 'edit' ) ),
$this->title->getUserPermissionsErrors( 'edit',
$this->user ) );
$this->assertEquals( false,
$this->title->quickUserCan( 'edit', $this->user ) );
$this->assertEquals( array( array( 'badaccess-group0' ),
- array( 'protectedpagetext', 'bogus' ),
- array( 'protectedpagetext', 'editprotected' ),
- array( 'protectedpagetext', 'protect' ) ),
+ array( 'protectedpagetext', 'bogus', 'bogus' ),
+ array( 'protectedpagetext', 'editprotected', 'bogus' ),
+ array( 'protectedpagetext', 'protect', 'bogus' ) ),
$this->title->getUserPermissionsErrors( 'bogus',
$this->user ) );
- $this->assertEquals( array( array( 'protectedpagetext', 'bogus' ),
- array( 'protectedpagetext', 'editprotected' ),
- array( 'protectedpagetext', 'protect' ) ),
+ $this->assertEquals( array( array( 'protectedpagetext', 'bogus', 'edit' ),
+ array( 'protectedpagetext', 'editprotected', 'edit' ),
+ array( 'protectedpagetext', 'protect', 'edit' ) ),
$this->title->getUserPermissionsErrors( 'edit',
$this->user ) );
$this->assertEquals( false,
$this->title->quickUserCan( 'edit', $this->user ) );
$this->assertEquals( array( array( 'badaccess-group0' ),
- array( 'protectedpagetext', 'bogus' ),
- array( 'protectedpagetext', 'protect' ),
- array( 'protectedpagetext', 'protect' ) ),
+ array( 'protectedpagetext', 'bogus', 'bogus' ),
+ array( 'protectedpagetext', 'protect', 'bogus' ),
+ array( 'protectedpagetext', 'protect', 'bogus' ) ),
$this->title->getUserPermissionsErrors( 'bogus',
$this->user ) );
- $this->assertEquals( array( array( 'protectedpagetext', 'bogus' ),
- array( 'protectedpagetext', 'protect' ),
- array( 'protectedpagetext', 'protect' ) ),
+ $this->assertEquals( array( array( 'protectedpagetext', 'bogus', 'edit' ),
+ array( 'protectedpagetext', 'protect', 'edit' ),
+ array( 'protectedpagetext', 'protect', 'edit' ) ),
$this->title->getUserPermissionsErrors( 'edit',
$this->user ) );
}
$this->assertEquals( false,
$this->title->userCan( 'bogus', $this->user ) );
- $this->assertEquals( array( array( "cascadeprotected", 2, "* [[:Bogus]]\n* [[:UnBogus]]\n" ),
- array( "cascadeprotected", 2, "* [[:Bogus]]\n* [[:UnBogus]]\n" ),
- array( "cascadeprotected", 2, "* [[:Bogus]]\n* [[:UnBogus]]\n" ) ),
+ $this->assertEquals( array(
+ array( "cascadeprotected", 2, "* [[:Bogus]]\n* [[:UnBogus]]\n", 'bogus' ),
+ array( "cascadeprotected", 2, "* [[:Bogus]]\n* [[:UnBogus]]\n", 'bogus' ),
+ array( "cascadeprotected", 2, "* [[:Bogus]]\n* [[:UnBogus]]\n", 'bogus' ) ),
$this->title->getUserPermissionsErrors( 'bogus', $this->user ) );
$this->assertEquals( true,
public function testActionPermissions() {
$this->setUserPerm( array( "createpage" ) );
$this->setTitle( NS_MAIN, "test page" );
- $this->title->mTitleProtection['pt_create_perm'] = '';
- $this->title->mTitleProtection['pt_user'] = $this->user->getID();
- $this->title->mTitleProtection['pt_expiry'] = wfGetDB( DB_SLAVE )->getInfinity();
- $this->title->mTitleProtection['pt_reason'] = 'test';
+ $this->title->mTitleProtection['permission'] = '';
+ $this->title->mTitleProtection['user'] = $this->user->getID();
+ $this->title->mTitleProtection['expiry'] = wfGetDB( DB_SLAVE )->getInfinity();
+ $this->title->mTitleProtection['reason'] = 'test';
$this->title->mCascadeRestriction = false;
$this->assertEquals( array( array( 'titleprotected', 'Useruser', 'test' ) ),
$this->assertEquals( false,
$this->title->userCan( 'create', $this->user ) );
- $this->title->mTitleProtection['pt_create_perm'] = 'sysop';
+ $this->title->mTitleProtection['permission'] = 'editprotected';
$this->setUserPerm( array( 'createpage', 'protect' ) );
$this->assertEquals( array( array( 'titleprotected', 'Useruser', 'test' ) ),
$this->title->getUserPermissionsErrors( 'create', $this->user ) );