User rights and groups – Remove user groups

From Linux Web Expert

There may be rare situations where a system administrator may want to remove the user groups "Administrator (Semantic Mediawiki)" (smwadministrator) and/or "Curator (Semantic Mediawiki)" (smwcurator) provided by Semantic MediaWiki from a wiki instance. In general doing this is neither necessary nor advisable.

In these situations the following code has to be added to the wiki's "LocalSetting.php" file preferably after the enableSemantics() call:

For Semantic MediaWiki ≥ 3.0.0
$GLOBALS['wgHooks']['SMW::Setup::AfterInitializationComplete'][] = function( &$vars ) {
	if( array_key_exists( 'smwcurator', $vars['wgGroupPermissions'] ) ) {
		unset( $vars['wgGroupPermissions']['smwcurator'] );
	}
	if( array_key_exists( 'smwadministrator', $vars['wgGroupPermissions'] ) ) {
		unset( $vars['wgGroupPermissions']['smwadministrator'] );
	}
};
For Semantic MediaWiki < 3.0.0
$GLOBALS['wgExtensionFunctions'][] = function() {
	if( array_key_exists( 'smwcurator', $GLOBALS['wgGroupPermissions'] ) ) {
		unset( $GLOBALS['wgGroupPermissions']['smwcurator'] );
	}
	if( array_key_exists( 'smwadministrator', $GLOBALS['wgGroupPermissions'] ) ) {
		unset( $GLOBALS['wgGroupPermissions']['smwadministrator'] );
	}
};
#scite could not render a citation text for reference "gh:smw:2565" because type "issue" was not assigned to a template.