Robert Vogel has submitted this change and it was merged.
Change subject: added method getUserInGroups
......................................................................
added method getUserInGroups
Change-Id: Icf6952d1d991596a64736d19af81f73f49494b45
---
M includes/utility/GroupHelper.class.php
1 file changed, 27 insertions(+), 0 deletions(-)
Approvals:
Robert Vogel: Verified; Looks good to me, approved
diff --git a/includes/utility/GroupHelper.class.php
b/includes/utility/GroupHelper.class.php
index 5ee56c1..3a9fd3f 100644
--- a/includes/utility/GroupHelper.class.php
+++ b/includes/utility/GroupHelper.class.php
@@ -141,4 +141,31 @@
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: merged
Gerrit-Change-Id: Icf6952d1d991596a64736d19af81f73f49494b45
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Tweichart <[email protected]>
Gerrit-Reviewer: Mglaser <[email protected]>
Gerrit-Reviewer: Pigpen <[email protected]>
Gerrit-Reviewer: Robert Vogel <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits