Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 1 Rev 15342
Línea 29... Línea 29...
29
    protected $hasIdentity;
29
    protected $hasIdentity;
Línea 30... Línea 30...
30
    
30
    
31
    
31
    
-
 
32
    /**
-
 
33
     *
-
 
34
     * @var boolean
-
 
35
     */
-
 
36
    protected $hasImpersonate;
-
 
37
    
-
 
38
    
32
    /**
39
    /**
33
     *
40
     *
34
     * @return \LeadersLinked\Model\User
41
     * @return \LeadersLinked\Model\User
Línea -... Línea 42...
-
 
42
     */
-
 
43
    protected $user;
-
 
44
    
-
 
45
    
-
 
46
    
-
 
47
    /**
-
 
48
     *
-
 
49
     * @return \LeadersLinked\Model\User
35
     */
50
     */
36
    protected $user;
51
    protected $impersonateUser;
37
    
52
    
38
    
53
    
39
    /***
54
    /***
Línea 48... Línea 63...
48
     * @param AdapterInterface $adapter
63
     * @param AdapterInterface $adapter
49
     */
64
     */
50
    public function __construct($adapter) 
65
    public function __construct($adapter) 
51
    {
66
    {
52
        $this->auth = new \Laminas\Authentication\AuthenticationService();
67
        $this->auth = new \Laminas\Authentication\AuthenticationService();
-
 
68
        $this->impersonateUser = null;
53
        $this->hasIdentity = false;
69
        $this->hasIdentity = false;
-
 
70
        $this->hasImpersonate = false;
-
 
71
        
54
        if($this->auth->hasIdentity()) {
72
        if($this->auth->hasIdentity()) {
55
            $identity = $this->auth->getIdentity();
73
            $identity = $this->auth->getIdentity();
Línea 56... Línea 74...
56
 
74
 
57
            $userMapper     = \LeadersLinked\Mapper\UserMapper::getInstance($adapter);
75
            $userMapper     = \LeadersLinked\Mapper\UserMapper::getInstance($adapter);
Línea 58... Línea 76...
58
            $this->user     = $userMapper->fetchOne($identity['user_id']);
76
            $this->user     = $userMapper->fetchOne($identity['user_id']);
59
     
77
     
Línea -... Línea 78...
-
 
78
            if($this->user) {
-
 
79
                $this->hasIdentity = true;
-
 
80
                
-
 
81
                if($this->user->impersonate_user_id) {
-
 
82
                    $this->hasImpersonate = true;
-
 
83
                    $this->impersonateUser = $userMapper->fetchOne($this->user->impersonate_user_id);
60
            if($this->user) {
84
                }
61
                $this->hasIdentity = true;
85
                
62
                
86
                
63
                if($identity['company_id']) {
87
                if($identity['company_id']) {
64
                    $companyMapper = CompanyMapper::getInstance($adapter);
88
                    $companyMapper = CompanyMapper::getInstance($adapter);
Línea 77... Línea 101...
77
    {
101
    {
Línea 78... Línea 102...
78
        
102
        
79
        return $this->user;
103
        return $this->user;
Línea -... Línea 104...
-
 
104
    }
-
 
105
    
80
    }
106
    
81
    
107
    
82
    /**
108
    /**
83
     * 
109
     *
84
     * @return string
110
     * @return \LeadersLinked\Model\User
85
     */
111
     */
-
 
112
    public function getImpersonateUser()
86
    public function getDeviceId()
113
    {
87
    {
114
        
-
 
115
        return $this->impersonateUser;
Línea 88... Línea 116...
88
        return $this->deviceId;
116
    }
89
    }
117
    
90
 
118
 
91
    
119
    
92
    /**
120
     /**
93
     * 
121
     * 
94
     * @return int
122
     * @return int
-
 
123
     */
-
 
124
    public function getUserId()
-
 
125
    {
95
     */
126
        if($this->hasIdentity) {
-
 
127
            if($this->hasImpersonate) {
96
    public function getUserId()
128
                return $this->impersonateUser->id;
97
    {
129
            } else {
98
        if($this->hasIdentity) {
130
                return $this->user->id;
99
            return $this->user->id;
131
            }
Línea 107... Línea 139...
107
     * @return string
139
     * @return string
108
     */
140
     */
109
    public function getUserTypeId()
141
    public function getUserTypeId()
110
    {
142
    {
111
        if($this->hasIdentity) {
143
        if($this->hasIdentity) {
-
 
144
            if($this->hasImpersonate) {
-
 
145
                return $this->impersonateUser->usertype_id;
-
 
146
            } else {
112
           return $this->user->usertype_id;
147
                return $this->user->usertype_id;
-
 
148
            }
113
        } else {
149
        } else {
114
            return UserType::GUEST;
150
            return UserType::GUEST;
115
        }
151
        }
116
    }
152
    }
Línea -... Línea 153...
-
 
153
    
-
 
154
    /**
-
 
155
     *
-
 
156
     * @return boolean
-
 
157
     */
-
 
158
    public function hasImpersonate()
-
 
159
    {
-
 
160
        return $this->hasImpersonate;
-
 
161
    }
-
 
162
    
-
 
163
    
-
 
164
   
-
 
165
    /**
-
 
166
     * 
-
 
167
     * @return boolean
-
 
168
     */
-
 
169
    public function hasIdentity() 
-
 
170
    {
-
 
171
        return $this->hasIdentity;
-
 
172
    }
Línea 117... Línea 173...
117
    
173
    
118
    
174
    
119
    /**
175
    /**
120
     * 
176
     * 
Línea 131... Línea 187...
131
            
187
            
132
        } else {
188
        } else {
133
            return 0;
189
            return 0;
134
        }
190
        }
135
    }
191
    }
136
    
-
 
137
    /**
-
 
138
     * 
-
 
139
     * @return boolean
-
 
140
     */
-
 
141
    public function hasIdentity() 
-
 
142
    {
-
 
143
        return $this->user ? true : false;
-
 
Línea 144... Línea 192...
144
    }
192
 
145
    
193
    
146
    public function clearIdentity()
194
    public function clearIdentity()
147
    {
195
    {