Page MenuHomePhabricator

permissions must be checked on item creation
Closed, ResolvedPublic

Description

Currently, permissions are only checked correctly when modifying existing items, not when creating items. The reason is that permission checks are title based, but we can only have a title after the item has been recorded in the database. Which we don't want to do if the user shouldn't be allow to create the item.

So... make a dummy title? or just check user rights, and not title based permissions?

Note: the ultimate permission check should be implemented in Item::save().


Version: master
Severity: critical
Whiteboard: storypoints: 5

Details

Reference
bz37989

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 22 2014, 12:30 AM
bzimport set Reference to bz37989.
bzimport added a subscriber: Unknown Object (MLST).

The simplest (and probably most robust solution) may be to construct a dummy Title for a page in the data namespace, e.g. Data:Q0, and call userCan() on that.

This would bypass page protection against creation as well as the title backlist and similar things, but these do not apply to the ID-based titles used by wikidata anyway.

(side note... should the title blacklist apply to item labels and aliases?)

See ItemContent::UserCanEdit

Consider API wbsetitem({}) and the Special:CreateItem page.

Verified in Wikidata demo time for sprint 15