Restrict who can create items and properties

Restrict who can create items and properties

In this short tutorial we look at how you can restrict who can create new items (and properties) in your Wikibase.

Wikibase Defaults

Wikibase comes with configuration that makes sense for Wikidata.org, and similar use cases. Wikidata is an open wiki, where everyone can create and edit items. The only restriction in place is that you cannot create new properties, unless you are added to the “property creators” group.

Restriction of editing

Many organizations do not want everyone, including people without an account, to edit their Wikibase. The same goes for standard MediaWiki without Wikibase. Many opt to requiring an account to edit, and then restrict who can get an account.

Requiring an account to make changes in the wiki:

$wgGroupPermissions['*']['edit'] = false;

You can go further and require the user to be part of a special group to edit.

$wgGroupPermissions['user']['edit'] = false;
$wgGroupPermissions['your-user-group']['edit'] = true;

For more information, see the user rights manual.

If you wish to restrict editing of just items or properties, you can use the wgNamespaceProtection setting:

$wgNamespaceProtection[WB_NS_ITEM] = [ 'your-item-editors' ];
$wgNamespaceProtection[WB_NS_PROPERTY] = [ 'your-property-editors' ];

Restriction of creation

If you prevent users from editing, they cannot make any changes, including creating new pages such as Wikibase items. What if you want to require users to be part of a group so they can create items or properties, while letting other users still edit those items and properties?

In case of properties, you can use the property-create right provided by Wikibase:

$wgGroupPermissions['*']['property-create'] = false;
$wgGroupPermissions['your-property-creators']['property-create'] = false;

For items things are a bit more tricky, since there is no item-create right. We can work around this by using the Lockdown extension:

wfLoadExtension( 'Lockdown' );
$wgSpecialPageLockdown['NewItem'] = [ 'your-item-creators' ];
$wgNamespacePermissionLockdown[WB_NS_ITEM]['createpage'] = [ 'your-item-creators' ];

This allows you to restrict creation of items and/or properties in your Wikibase to trusted users, while allowing more people, perhaps everyone, to edit existing items and/or properties.

 

 

 

Leave a Comment

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published.