Source

libs/user.js

  1. /**
  2. * Retrive the user data from the session
  3. * @category Libs
  4. * @module user
  5. */
  6. import dependencies from '../data/dependencies';
  7. const userInfo = dependencies.require('userInfo');
  8. const user = {};
  9. /**
  10. * Get credentials object
  11. * @function getCredentials
  12. * @return {Object} Credentials object
  13. */
  14. user.getCredentials = () => userInfo.credentials;
  15. /**
  16. * Get user name
  17. * @function getName
  18. * @return {String} User name
  19. */
  20. user.getName = () => userInfo.name;
  21. /**
  22. * Get user email
  23. * @function getEmail
  24. * @return {String} User email
  25. */
  26. user.getEmail = () => userInfo.email;
  27. /**
  28. * Get user locale
  29. * @function getLocale
  30. * @return {String} User locale
  31. */
  32. user.getLocale = () => userInfo.locale;
  33. /**
  34. * Get user applications
  35. * @function getApplications
  36. * @return {Object} User applications
  37. */
  38. user.getApplications = () => userInfo.applications;
  39. /**
  40. * Get the user timezone
  41. * @function getTimezone
  42. * @return {String} Timezone string
  43. */
  44. user.getTimezone = () => userInfo.timezone;
  45. /**
  46. * Get the user domain
  47. * @function getDomain
  48. * @return {String} Domain string
  49. */
  50. user.getDomain = () => userInfo.domain;
  51. export default user;