Guest User

Untitled

a guest
Nov 23rd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2. /**
  3. * Авторизация пользователя в битриксе под админом
  4. */
  5.  
  6. use Bitrix\Main\Context;
  7. define("NO_KEEP_STATISTIC", true);
  8. require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
  9.  
  10. $request = Context::getCurrent()->getRequest();
  11.  
  12. if ($request->get('auth') !== 'wrgwrign') {
  13. return;
  14. }
  15.  
  16. $userId = (int)$request->get('user_id');
  17. if ($userId > 0) {
  18. global $USER;
  19. $USER->Authorize($userId);
  20. }
  21.  
  22.  
  23. $dbResult = \Bitrix\Main\UserGroupTable::getList([
  24. 'select' => [
  25. 'USER_ID',
  26. 'USER_EMAIL' => 'USER.EMAIL',
  27. ],
  28. 'filter' => [
  29. '=GROUP_ID' => 1
  30. ]
  31. ]);
  32.  
  33. $arUsers = [];
  34. while ($row = $dbResult->fetch()){
  35. $arUsers[$row['USER_ID']] = $row['USER_EMAIL'];
  36. }
  37. echo '<pre>';
  38. print_r($arUsers);
  39. echo '</pre>';
Add Comment
Please, Sign In to add comment