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 it supports is that you cannot create new properties unless your user account is in the “property creators” group. By default, everyone is in this 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 choose to require 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 like 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 the 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 the 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.

Wikibase Permission UI

2024 addition: you can now configure Wikibase permissions via the Wikibase dashboard available to Professional Wiki customers.

 

Leave a Comment

Comments

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

Leave a Reply

Your email address will not be published. Required fields are marked *