镜像自地址
https://github.com/wikimedia/mediawiki-extensions-GlobalUserrights.git
已同步 2024-06-03 02:40:46 +08:00
Attempt to lookup UID by UserIdentity
Change-Id: Ib00b791cfeb206b1f8eb697985444c7d1754f849
这个提交包含在:
父节点
2244f41f1e
当前提交
3143cdeb73
|
@ -1,13 +1,14 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
|
||||
class GlobalUserrightsHooks {
|
||||
|
||||
/**
|
||||
* Function to get a given user's global groups
|
||||
*
|
||||
* @param User|int $user instance of User class or uid
|
||||
* @param UserIdentity|int $user instance of UserIdentity class or uid
|
||||
* @return array of global groups
|
||||
*/
|
||||
public static function getGroups( $user ) {
|
||||
|
@ -17,11 +18,11 @@ class GlobalUserrightsHooks {
|
|||
/**
|
||||
* Function to get a given user's global groups memberships
|
||||
*
|
||||
* @param int|User $user instance of User class or uid
|
||||
* @param int|UserIdentity $user instance of UserIdentity class or uid
|
||||
* @return array
|
||||
*/
|
||||
public static function getGroupMemberships( $user ) {
|
||||
if ( $user instanceof User ) {
|
||||
if ( $user instanceof UserIdentity ) {
|
||||
if ( method_exists( MediaWikiServices::class, 'getCentralIdLookupFactory' ) ) {
|
||||
// MW1.37+
|
||||
$uidLookup = MediaWikiServices::getInstance()->getCentralIdLookupFactory()->getLookup();
|
||||
|
|
正在加载...
在新工单中引用
屏蔽一个用户