dbarratt moved this task from Blocked / Waiting / External to Needs Work on the 
Wikidata-Campsite board.
dbarratt added a comment.


  In T207893#5250838 <https://phabricator.wikimedia.org/T207893#5250838>, 
@Addshore wrote:
  
  >
  
  
  > So I guess we use BlockManager to get the blocks of a user?
  
  You can use either `User::getBlock()` or `BlockManager::getUserBlock()`. They 
are //slightly// different, but for your purposes, it should always return the 
same result.
  
  > And then check the blocks to see if they apply to the namespace we are 
creating in?
  
  Yes. :)
  
  > Blockmanager::getUserBlock only returns one block ("the most relevant 
one"), what happens in the situation when a user has 2 block for different 
namespaces?
  
  You will get a `CompositeBlock` object which will extend from `AbstractBlock` 
class and have all of the same methods. MediaWiki has, up until this week, 
always returned a single, most-relevant block anyways. Starting soon, you'll 
get a `CompositeBlock` which can be used the same way.
  
  > Is there a way to get all blocks of a user? Or a way to see if any of a 
users blocks apply to a namespace?
  
  We could probably build that into `CompositeBlock` if you really need them, 
but calling `::appliesToNamespace()` on the `AbstractBlock` returned from 
`User::getBlock()` should be what you want.
  
  > Maybe we need a User::isBlockedFromNamespace, or rather 
PermissionManager::isBlockedFromNamespace() ?
  
  I think the best way would be to determine if the `AbstractBlock` applies to 
the namespace with `AbstractBlock::appliesToNamespace()`.

TASK DETAIL
  https://phabricator.wikimedia.org/T207893

WORKBOARD
  https://phabricator.wikimedia.org/project/board/3402/

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: dbarratt
Cc: Niharika, Lydia_Pintscher, WMDE-leszek, TBolliger, Lucas_Werkmeister_WMDE, 
Addshore, Aklapper, dbarratt, MGChecker, darthmon_wmde, Nandana, Lahi, Gq86, 
GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Jonas, 
Wikidata-bugs, aude, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to