simple fix for box 32b
[openemr.git] / services / UserService.php
blob216fd77f5f0f3a3b2df2d3bff82e053603f6428b
1 <?php
2 /**
3 * UserService
5 * Copyright (C) 2017 Matthew Vita <matthewvita48@gmail.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author Matthew Vita <matthewvita48@gmail.com>
20 * @author Victor Kofia <victor.kofia@gmail.com>
21 * @link http://www.open-emr.org
24 namespace services;
26 class UserService {
27 /**
28 * The user repository to be used for db CRUD operations.
30 private $repository;
32 /**
33 * Default constructor.
35 public function __construct() {
36 $database = \common\database\Connector::Instance();
37 $entityManager = $database->entityManager;
38 $this->repository = $entityManager->getRepository('\entities\User');
41 /**
42 * @return Fully hydrated user object
44 public function getUser($userId) {
45 return $this->repository->getUser($userId);
48 /**
49 * @return active users (fully hydrated)
51 public function getActiveUsers() {
52 return $this->repository->getActiveUsers();
55 /**
56 * @return Fully hydrated user object.
58 public function getCurrentlyLoggedInUser() {
59 return $this->repository->getCurrentlyLoggedInUser();
62 /**
63 * Centralized holder of the `authProvider` session
64 * value to encourage service ownership of global
65 * session values.
67 * @return String of the current user group.
69 public function getCurrentlyLoggedInUserGroup() {
70 return $_SESSION['authProvider'];