Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
37.50% covered (danger)
37.50%
3 / 8
50.00% covered (danger)
50.00%
3 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
LtiProviderUser
37.50% covered (danger)
37.50%
3 / 8
50.00% covered (danger)
50.00%
3 / 6
18.96
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIdentifier
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getPropertyValues
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
 refresh
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getRoles
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getLtiProvider
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; under version 2
7 * of the License (non-upgradable).
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 *
18 * Copyright (c) 2019 (original work) Open Assessment Technologies SA;
19 */
20
21namespace oat\taoLti\models\classes\Lis;
22
23use common_user_User;
24use oat\taoLti\models\classes\LtiProvider\LtiProvider;
25
26/**
27 * User authenticated by LisAuthAdapter
28 */
29class LtiProviderUser extends common_user_User
30{
31    public const PROPERTY_PROVIDER = 'property_provider';
32
33    /**
34     * @var LtiProvider
35     */
36    private $ltiProvider;
37
38    /**
39     * @param LtiProvider $ltiProvider
40     */
41    public function __construct(LtiProvider $ltiProvider)
42    {
43        $this->ltiProvider = $ltiProvider;
44    }
45
46    /**
47     * @return string
48     */
49    public function getIdentifier()
50    {
51        return 'ltiProvider_' . $this->ltiProvider->getId();
52    }
53
54    /**
55     * @param string $property
56     * @return LtiProvider[]
57     */
58    public function getPropertyValues($property)
59    {
60        if ($property === self::PROPERTY_PROVIDER) {
61            return [$this->getLtiProvider()];
62        }
63        return [];
64    }
65
66    /**
67     * @return bool
68     */
69    public function refresh()
70    {
71        return true;
72    }
73
74    /**
75     * @return string[]
76     */
77    public function getRoles()
78    {
79        return [];
80    }
81
82    /**
83     * @return LtiProvider
84     */
85    public function getLtiProvider()
86    {
87        return $this->ltiProvider;
88    }
89}