minor fixes to prior commit
[openemr.git] / services / UserService.php
blob958dc0363c5c8d566976a8c696eee5b69b5e110e
1 <?php
2 /**
3 * UserService
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Matthew Vita <matthewvita48@gmail.com>
8 * @author Victor Kofia <victor.kofia@gmail.com>
9 * @copyright Copyright (c) 2017 Matthew Vita <matthewvita48@gmail.com>
10 * @copyright Copyright (c) 2017 Victor Kofia <victor.kofia@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 namespace OpenEMR\Services;
17 use OpenEMR\Common\Database\Connector;
19 class UserService
21 /**
22 * The user repository to be used for db CRUD operations.
24 private $repository;
26 /**
27 * Default constructor.
29 public function __construct()
31 $database = Connector::Instance();
32 $entityManager = $database->entityManager;
33 $this->repository = $entityManager->getRepository('\OpenEMR\Entities\User');
36 /**
37 * @return Fully hydrated user object
39 public function getUser($userId)
41 return $this->repository->getUser($userId);
44 /**
45 * @return active users (fully hydrated)
47 public function getActiveUsers()
49 return $this->repository->getActiveUsers();
52 /**
53 * @return Fully hydrated user object.
55 public function getCurrentlyLoggedInUser()
57 return $this->repository->getCurrentlyLoggedInUser();
60 /**
61 * Centralized holder of the `authProvider` session
62 * value to encourage service ownership of global
63 * session values.
65 * @return String of the current user group.
67 public function getCurrentlyLoggedInUserGroup()
69 return $_SESSION['authProvider'];