jenkins-bot has submitted this change and it was merged. Change subject: Check user rights when restricting entity page actions ......................................................................
Check user rights when restricting entity page actions (bug 48086) In addition to the user groups, the rights are checked as well now. This will detect the "autoconfirmed" right set on custom groups preventing disabling of entity page actions when a page is semi-protected. Change-Id: Iaa4cc13edda213b3b17a8fd9912a23fc0658a6e9 --- M repo/resources/wikibase.ui.entityViewInit.js 1 file changed, 11 insertions(+), 12 deletions(-) Approvals: Tobias Gritschacher: Looks good to me, approved jenkins-bot: Verified diff --git a/repo/resources/wikibase.ui.entityViewInit.js b/repo/resources/wikibase.ui.entityViewInit.js index 3aed414..7e60e65 100644 --- a/repo/resources/wikibase.ui.entityViewInit.js +++ b/repo/resources/wikibase.ui.entityViewInit.js @@ -185,18 +185,17 @@ } ); } ); - if ( - mw.config.get( 'wgRestrictionEdit' ) !== null && - mw.config.get( 'wgRestrictionEdit' ).length === 1 - ) { // editing is restricted - if ( - $.inArray( - mw.config.get( 'wgRestrictionEdit' )[0], - mw.config.get( 'wgUserGroups' ) - ) === -1 - ) { - // user is not allowed to edit - $( wb ).triggerHandler( 'restrictEntityPageActions' ); + // Restrict entity page actions if editing is restricted: + var editRestriction = mw.config.get( 'wgRestrictionEdit' ); + if( editRestriction !== null && editRestriction.length === 1 ) { + var hasGroup = $.inArray( editRestriction[0], mw.config.get( 'wgUserGroups' ) ); + if( !hasGroup ) { + mw.user.getRights( function( rights ) { + var hasRight = $.inArray( editRestriction, rights ) !== -1; + if( !hasRight ) { + $( wb ).triggerHandler( 'restrictEntityPageActions' ); + } + } ); } } -- To view, visit https://gerrit.wikimedia.org/r/98796 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iaa4cc13edda213b3b17a8fd9912a23fc0658a6e9 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Henning Snater <henning.sna...@wikimedia.de> Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits