auth.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. // rename file to: `config.php`
  3. // @used by User class to login
  4. // - [ ] use to fetch user groups for acl
  5. /**
  6. * User object:
  7. * - ID // ADM_ID
  8. * - ADM_ACCOUNT // AUTHORIZE_USER, ADM_ACCOUNT
  9. * - ADM_NAME // ADM_NAME
  10. * - ADM_TECH_WORKER // ADM_TECH_WORKER
  11. * - ADM_COMPANY // ADM_COMPANY
  12. * - ADM_ADMIN_LEVEL // ADM_ADMIN_LEVEL
  13. * - ADM_PHONE // ADM_PHONE
  14. * - ADM_ADMIN_EXPIRE // ADM_ADMIN_EXPIRE
  15. * - ADM_ADMIN_DESC // ADM_ADMIN_DESC
  16. * - EMPLOYEE_TYPE // EMPLOYEE_TYPE
  17. * - EMAIL_IMAP_IMPORT_HOST // EMAIL_IMAP_IMPORT_HOST
  18. * - EMAIL_IMAP_IMPORT_USERNAME // EMAIL_IMAP_IMPORT_USERNAME
  19. */
  20. class Theme_Auth_panel_biall_net { // TODO: implements AuthBaseInterface {
  21. static function login($login, $pass) { // @return User object or null
  22. if (empty($login) || empty($pass)) throw new Exception("Proszę podać poprawny login i hasło!");
  23. { // TODO: TEST
  24. $login = "krzys.dworski@gmail.com"; // COMPANIES.user_mail_contact
  25. $pass = "76022801989"; // TODO: COMPANIES.P_PESEL or COMPANIES.PASSWD varchar(100) ?
  26. }
  27. $item = DB::getPDO()->fetchFirst("
  28. select c.ID, c.user_mail_contact, c.P_PESEL, c.PASSWD
  29. from COMPANIES c
  30. where c.user_mail_contact like :email
  31. ", [
  32. ':email' => $login,
  33. ]);
  34. // [ID] => 12807
  35. // [user_mail_contact] => krzys.dworski@gmail.com
  36. // [P_PESEL] => 76022801989
  37. // [PASSWD] => 76022801989
  38. throw new Exception("TODO: Proszę podać poprawny login i hasło!");
  39. return null;
  40. return (object)[
  41. 'ID' => "", // ADM_ID
  42. 'ADM_ACCOUNT' => "", // AUTHORIZE_USER, ADM_ACCOUNT
  43. 'ADM_NAME' => "", // ADM_NAME
  44. 'ADM_TECH_WORKER' => "", // ADM_TECH_WORKER
  45. 'ADM_COMPANY' => "", // ADM_COMPANY
  46. 'ADM_ADMIN_LEVEL' => "", // ADM_ADMIN_LEVEL
  47. 'ADM_PHONE' => "", // ADM_PHONE
  48. 'ADM_ADMIN_EXPIRE' => "", // ADM_ADMIN_EXPIRE
  49. 'ADM_ADMIN_DESC' => "", // ADM_ADMIN_DESC
  50. 'EMPLOYEE_TYPE' => "", // EMPLOYEE_TYPE
  51. ];
  52. }
  53. }