Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5973616
GlobalGroupLookup.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
GlobalGroupLookup.php
View Options
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
namespace
MediaWiki\Extension\CentralAuth\GlobalGroup
;
use
MediaWiki\Extension\CentralAuth\CentralAuthDatabaseManager
;
use
Wikimedia\Rdbms\IDBAccessObject
;
/**
* @since 1.37
* @author Taavi "Majavah" Väänänen <hi@taavi.wtf>
*/
class
GlobalGroupLookup
{
private
CentralAuthDatabaseManager
$dbManager
;
public
function
__construct
(
CentralAuthDatabaseManager
$dbManager
)
{
$this
->
dbManager
=
$dbManager
;
}
/**
* Returns all defined global groups.
* @param int $flags One of the IDBAccessObject::READ_* constants
* @return string[]
*/
public
function
getDefinedGroups
(
int
$flags
=
IDBAccessObject
::
READ_NORMAL
):
array
{
$dbr
=
$this
->
dbManager
->
getCentralDBFromRecency
(
$flags
);
return
$dbr
->
newSelectQueryBuilder
()
->
select
(
'ggp_group'
)
->
distinct
()
->
from
(
'global_group_permissions'
)
->
recency
(
$flags
)
->
caller
(
__METHOD__
)
->
fetchFieldValues
();
}
/**
* Returns all rights assigned to a specified global group.
* @param string $group
* @param int $flags One of the IDBAccessObject::READ_* constants
* @return string[]
*/
public
function
getRightsForGroup
(
string
$group
,
int
$flags
=
IDBAccessObject
::
READ_NORMAL
):
array
{
$dbr
=
$this
->
dbManager
->
getCentralDBFromRecency
(
$flags
);
return
$dbr
->
newSelectQueryBuilder
()
->
select
(
'ggp_permission'
)
->
from
(
'global_group_permissions'
)
->
where
(
[
'ggp_group'
=>
$group
]
)
->
recency
(
$flags
)
->
caller
(
__METHOD__
)
->
fetchFieldValues
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 16:46 (8 h, 33 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f0/55/c578cc793e5b96529e62523b573f
Default Alt Text
GlobalGroupLookup.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment