public function ForcePasswordChangeService::getUsersForRole in Force Password Change 2.0.x
Same name and namespace in other branches
- 8 src/Service/ForcePasswordChangeService.php \Drupal\force_password_change\Service\ForcePasswordChangeService::getUsersForRole()
Retrieve the users in a given role.
Parameters
string $rid: The Role ID of the role for which users should be retrieved.
bool $uidOnly: A boolean indicating whether the the User IDs should be returned, or the fullly loaded user objects.
Return value
array If $uidOnly is set to TRUE, an array of User IDs for users in the given role. If $uidOnly is set to FALSE, an array of fully loaded user objects for users in the given role.
Overrides ForcePasswordChangeServiceInterface::getUsersForRole
File
- src/
Service/ ForcePasswordChangeService.php, line 215
Class
Namespace
Drupal\force_password_change\ServiceCode
public function getUsersForRole($rid, $uidOnly = TRUE) {
$uids = $this->mapper
->getUserIdsForRole($rid);
if ($uidOnly) {
return $uids;
}
return $this
->userLoadMultiple($uids);
}