1: <?php
2:
3: namespace Mapbender\DrupalIntegrationBundle\Security\User;
4:
5: use Symfony\Component\Security\Core\User\UserInterface;
6:
7:
8: class DrupalUser implements UserInterface
9: {
10: private $uid;
11: private $username;
12: private $password;
13: private $email;
14: private $roles;
15:
16: public function __construct($user)
17: {
18: $this->uid = $user->uid;
19: if($user->uid != 0) {
20: $this->username = $user->name;
21: $this->password = $user->pass;
22: $this->email = $user->mail;
23: }
24: $this->roles = $user->roles;
25: }
26:
27: public function getId()
28: {
29: return $this->uid;
30: }
31:
32: public function getRoles()
33: {
34: return $this->roles;
35: }
36:
37: public function getPassword()
38: {
39: return $this->password;
40: }
41:
42: public function getSalt()
43: {
44: return '';
45: }
46:
47: public function getUsername()
48: {
49: return $this->username;
50: }
51:
52: public function getEmail()
53: {
54: return $this->email;
55: }
56:
57: public function eraseCredentials()
58: {
59: }
60:
61: public function equals(UserInterface $user)
62: {
63: if (!$user instanceof DrupalUser) {
64: return false;
65: }
66:
67: if($this->id !== $user->getId()) {
68: return false;
69: }
70:
71: return true;
72: }
73: }
74: