Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1 Rev 3639
Línea 28... Línea 28...
28
    protected $hasIdentity;
28
    protected $hasIdentity;
Línea 29... Línea 29...
29
    
29
    
30
    
30
    
-
 
31
    /**
-
 
32
     *
-
 
33
     * @var boolean
-
 
34
     */
-
 
35
    protected $hasImpersonate;
-
 
36
    
-
 
37
    
31
    /**
38
    /**
32
     *
39
     *
33
     * @return \LeadersLinked\Model\User
40
     * @return \LeadersLinked\Model\User
Línea -... Línea 41...
-
 
41
     */
-
 
42
    protected $user;
-
 
43
    
-
 
44
    
-
 
45
    /**
-
 
46
     *
-
 
47
     * @return \LeadersLinked\Model\User
34
     */
48
     */
35
    protected $user;
49
    protected $impersonateUser;
36
    
50
    
37
    /**
51
    /**
38
     * 
52
     * 
Línea 53... Línea 67...
53
    public function __construct($adapter) 
67
    public function __construct($adapter) 
54
    {
68
    {
Línea 55... Línea 69...
55
        
69
        
-
 
70
 
56
 
71
        $this->auth = new \Laminas\Authentication\AuthenticationService();
-
 
72
        $this->impersonate_user = null;
57
        $this->auth = new \Laminas\Authentication\AuthenticationService();
73
        $this->hasIdentity = false;
58
        $this->hasIdentity = false;
74
        $this->hasImpersonate = false;
59
        if($this->auth->hasIdentity()) {
75
        if($this->auth->hasIdentity()) {
Línea 60... Línea 76...
60
            $identity = $this->auth->getIdentity();
76
            $identity = $this->auth->getIdentity();
61
            $this->deviceId = isset($identity['device_id']) ? $identity['device_id'] : '';
77
            $this->deviceId = isset($identity['device_id']) ? $identity['device_id'] : '';
-
 
78
            
Línea 62... Línea 79...
62
            
79
            $userMapper     = \LeadersLinked\Mapper\UserMapper::getInstance($adapter);
-
 
80
            $this->user     = $userMapper->fetchOne($identity['user_id']);
63
            $userMapper     = \LeadersLinked\Mapper\UserMapper::getInstance($adapter);
81
            
-
 
82
     
-
 
83
            if($this->user) {
-
 
84
     
-
 
85
                $this->hasIdentity = true;
-
 
86
                if($this->user->impersonate_user_id) {
-
 
87
                    $this->hasImpersonate = true;
Línea 64... Línea 88...
64
            $this->user     = $userMapper->fetchOne($identity['user_id']);
88
                    $this->impersonate_user = $userMapper->fetchOne($this->user->impersonate_user_id);
65
     
89
                }
66
            if($this->user) {
90
                
67
                $this->hasIdentity = true;
91
               
Línea 79... Línea 103...
79
     * 
103
     * 
80
     * @return \LeadersLinked\Model\User
104
     * @return \LeadersLinked\Model\User
81
     */
105
     */
82
    public function getUser() 
106
    public function getUser() 
83
    {
107
    {
-
 
108
    
-
 
109
        if($this->hasImpersonate) {
-
 
110
            return $this->impersonate_user;
-
 
111
        } else {
-
 
112
            
-
 
113
            return $this->user;
-
 
114
        }
-
 
115
    }
-
 
116
    
-
 
117
    /**
-
 
118
     *
-
 
119
     * @return \LeadersLinked\Model\User
-
 
120
     */
-
 
121
    public function getRawUser()
-
 
122
    {
Línea 84... Línea 123...
84
        
123
        
-
 
124
        return $this->user;
85
        return $this->user;
125
        
Línea -... Línea 126...
-
 
126
    }
-
 
127
    
-
 
128
    
-
 
129
    /**
-
 
130
     *
-
 
131
     * @return \LeadersLinked\Model\User
-
 
132
     */
-
 
133
    public function getImpersonateUser()
-
 
134
    {
-
 
135
        
-
 
136
        return $this->impersonate_user;
-
 
137
    }
86
    }
138
 
87
    
139
    
88
    /**
140
    /**
89
     * 
141
     * 
90
     * @return string
142
     * @return string
Línea 108... Línea 160...
108
     * @return int
160
     * @return int
109
     */
161
     */
110
    public function getUserId()
162
    public function getUserId()
111
    {
163
    {
112
        if($this->hasIdentity) {
164
        if($this->hasIdentity) {
-
 
165
            if($this->hasImpersonate) {
-
 
166
                return $this->impersonate_user->id;
-
 
167
            } else {
113
            return $this->user->id;
168
                return $this->user->id;
-
 
169
            }
114
        } else {
170
        } else {
115
            return 0;
171
            return 0;
116
        }
172
        }
117
    }
173
    }
Línea 121... Línea 177...
121
     * @return string
177
     * @return string
122
     */
178
     */
123
    public function getUserTypeId()
179
    public function getUserTypeId()
124
    {
180
    {
125
        if($this->hasIdentity) {
181
        if($this->hasIdentity) {
-
 
182
            if($this->hasImpersonate) {
-
 
183
                return $this->impersonate_user->usertype_id;
-
 
184
            } else {
126
           return $this->user->usertype_id;
185
                return $this->user->usertype_id;
-
 
186
            }
127
        } else {
187
        } else {
128
            return UserType::GUEST;
188
            return UserType::GUEST;
129
        }
189
        }
130
    }
190
    }
Línea -... Línea 191...
-
 
191
    
-
 
192
    /**
-
 
193
     *
-
 
194
     * @return boolean
-
 
195
     */
-
 
196
    public function hasImpersonate()
-
 
197
    {
-
 
198
        return $this->hasImpersonate;
-
 
199
    }
Línea 131... Línea 200...
131
    
200
    
132
    
201
    
133
   
202
   
134
    /**
203
    /**
135
     * 
204
     * 
136
     * @return boolean
205
     * @return boolean
137
     */
206
     */
138
    public function hasIdentity() 
207
    public function hasIdentity() 
Línea 139... Línea 208...
139
    {
208
    {
140
        return $this->user ? true : false;
209
        return $this->hasIdentity;
141
    }
210
    }