fix some bugs on therapy groups (#604)
[openemr.git] / services / user_service.php
blobe4bb1c8b65f6a85f190ed108df1a1f66bedc1da8
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 * @link http://www.open-emr.org
23 namespace services;
25 class UserService {
26 /**
27 * The user repository to be used for db CRUD operations.
29 private $repository;
31 /**
32 * Default constructor.
34 public function __construct() {
35 $database = \common\database\Connector::Instance();
36 $entityManager = $database->entityManager;
37 $this->repository = $entityManager->getRepository('\entities\User');
40 /**
41 * @return Fully hydrated user object.
43 public function getCurrentlyLoggedInUser() {
44 return $this->repository->getCurrentlyLoggedInUser();
47 /**
48 * Centralized holder of the `authProvider` session
49 * value to encourage service ownership of global
50 * session values.
52 * @return String of the current user group.
54 public function getCurrentlyLoggedInUserGroup() {
55 return $_SESSION['authProvider'];