Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15342 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15342 Rev 17002
Línea 9... Línea 9...
9
use Laminas\Authentication\AuthenticationService;
9
use Laminas\Authentication\AuthenticationService;
10
use LeadersLinked\Model\Device;
10
use LeadersLinked\Model\Device;
11
use LeadersLinked\Mapper\DeviceMapper;
11
use LeadersLinked\Mapper\DeviceMapper;
12
use LeadersLinked\Model\UserType;
12
use LeadersLinked\Model\UserType;
13
use LeadersLinked\Mapper\CompanyMapper;
13
use LeadersLinked\Mapper\CompanyMapper;
-
 
14
use LeadersLinked\Library\Storage;
Línea 14... Línea 15...
14
 
15
 
15
 
16
 
Línea 16... Línea 17...
16
class CurrentUserPlugin extends AbstractPlugin
17
class CurrentUserPlugin extends AbstractPlugin
17
{
18
{
-
 
19
    
-
 
20
    /**
-
 
21
     * 
-
 
22
     * @var \LeadersLinked\Plugin\CurrentUserPlugin
-
 
23
     */
-
 
24
    private static $_instance;
18
    
25
    
19
    /**
26
    /**
20
     * 
27
     * 
Línea 21... Línea 28...
21
     * @var AuthenticationService
28
     * @var AuthenticationService
22
     */
29
     */
23
    protected $auth;
30
    private $auth;
24
    
31
    
25
    /**
32
    /**
Línea 26... Línea 33...
26
     *
33
     *
27
     * @var boolean
34
     * @var boolean
28
     */
35
     */
29
    protected $hasIdentity;
36
    private $hasIdentity;
30
    
37
    
Línea 31... Línea 38...
31
    
38
    
32
    /**
39
    /**
33
     *
40
     *
34
     * @var boolean
41
     * @var boolean
35
     */
42
     */
Línea 36... Línea 43...
36
    protected $hasImpersonate;
43
    private $hasImpersonate;
37
    
44
    
38
    
45
    
39
    /**
46
    /**
40
     *
47
     *
Línea 41... Línea 48...
41
     * @return \LeadersLinked\Model\User
48
     * @return \LeadersLinked\Model\User
42
     */
49
     */
43
    protected $user;
50
    private $user;
44
    
51
    
45
    
52
    
Línea -... Línea 53...
-
 
53
    
-
 
54
    /**
-
 
55
     *
-
 
56
     * @return \LeadersLinked\Model\User
-
 
57
     */
Línea 46... Línea 58...
46
    
58
    private $impersonateUser;
47
    /**
59
    
-
 
60
    
48
     *
61
    /***
-
 
62
     * 
49
     * @return \LeadersLinked\Model\User
63
     * @var \LeadersLinked\Model\Company
50
     */
64
     */
51
    protected $impersonateUser;
65
    private $company;
-
 
66
    
-
 
67
    /**
-
 
68
     * 
-
 
69
     * @var array
-
 
70
     */
-
 
71
    private $config;
-
 
72
    
-
 
73
    /**
-
 
74
     *
-
 
75
     * @param array $config
-
 
76
     * @param AdapterInterface $adapter
-
 
77
     * @return \LeadersLinked\Plugin\CurrentUserPlugin
-
 
78
     */
-
 
79
    public static function getInstance($config, $adapter) 
-
 
80
    {
-
 
81
        if(self::$_instance == null) {
-
 
82
            self::$_instance = new CurrentUserPlugin($config, $adapter);
52
    
83
        }
53
    
84
        
54
    /***
85
        return self::$_instance;
55
     * 
86
    }
Línea 182... Línea 213...
182
    }
213
    }
Línea 183... Línea 214...
183
    
214
    
184
    public function getCompanyId()
215
    public function getCompanyId()
185
    {
216
    {
186
        if($this->company) {
-
 
-
 
217
        if($this->company) {
187
            
218
            return $this->company->id;
188
        } else {
219
        } else {
189
            return 0;
220
            return 0;
190
        }
221
        }
Línea 191... Línea 222...
191
    }
222
    }
192
 
223
 
193
    
224
    
194
    public function clearIdentity()
225
    public function clearIdentity()
-
 
226
    {
-
 
227
        $this->auth->clearIdentity();
-
 
228
    }
-
 
229
    
-
 
230
    
-
 
231
    public function getCompanyImage()
-
 
232
    {
-
 
233
        if($this->company) {
-
 
234
          
-
 
235
            $storage = Storage::getInstance($this->config);
-
 
236
            return $storage->getCompanyImage($this->company);
-
 
237
        } 
-
 
238
        
-
 
239
    }
-
 
240
    
-
 
241
    public function getCompanyCover()
-
 
242
    {
-
 
243
        if($this->company) {
-
 
244
            
-
 
245
            $storage = Storage::getInstance($this->config);
-
 
246
            return $storage->getCompanyCover($this->company);
-
 
247
        }
-
 
248
        
-
 
249
    }
-
 
250
    
-
 
251
    public function getUserImage()
-
 
252
    {
-
 
253
        if($this->user) {
-
 
254
            
-
 
255
            $storage = Storage::getInstance($this->config);
-
 
256
            return $storage->getUserImage($this->user);
Línea 195... Línea 257...
195
    {
257
        }
196
        $this->auth->clearIdentity();
258