Tweichart has uploaded a new change for review.
https://gerrit.wikimedia.org/r/204062
Change subject: added method getUserInGroups
......................................................................
added method getUserInGroups
Change-Id: Icf6952d1d991596a64736d19af81f73f49494b45
---
M includes/utility/GroupHelper.class.php
1 file changed, 21 insertions(+), 0 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation
refs/changes/62/204062/1
diff --git a/includes/utility/GroupHelper.class.php
b/includes/utility/GroupHelper.class.php
index 5ee56c1..ec75b7f 100644
--- a/includes/utility/GroupHelper.class.php
+++ b/includes/utility/GroupHelper.class.php
@@ -140,5 +140,26 @@
return false;
}
+
+ /**
+ * Returns an array of User being in one or all groups given
+ * @param mixed $aGroups
+ * @return array Array of User objects
+ */
+ public static function getUserInGroups( $aGroups ) {
+ $dbr = wfGetDB( DB_SLAVE );
+ if ( !is_array( $aGroups ) ) {
+ $aGroups = array( $aGroups );
+ }
+ $aUser = array();
+ $res = $dbr->select( 'user_groups', array( 'ug_user' ), array(
'ug_group' => $aGroups ), __METHOD__, array( 'DISTINCT' ) );
+ if ( !$res ) {
+ return $aUser;
+ }
+ while ( $row = $res->fetchObject() ) {
+ $aUser [] = User::newFromId( $row->ug_user );
+ }
+ return $aUser;
+ }
}
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/204062
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf6952d1d991596a64736d19af81f73f49494b45
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Tweichart <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits