1 | <?php |
||
25 | class User |
||
26 | { |
||
27 | /** |
||
28 | * @var \OpCacheGUI\Storage\Session The session |
||
29 | */ |
||
30 | private $sessionStorage; |
||
31 | |||
32 | /** |
||
33 | * @var string The username |
||
34 | */ |
||
35 | private $username; |
||
36 | |||
37 | /** |
||
38 | * @var string The password |
||
39 | */ |
||
40 | private $password; |
||
41 | |||
42 | /** |
||
43 | * @var \OpCacheGUI\Auth\Whitelist Instance of a IP whitelist |
||
44 | */ |
||
45 | private $whitelist; |
||
46 | |||
47 | /** |
||
48 | * Creates instance |
||
49 | * |
||
50 | * @param \OpCacheGUI\Storage\Session $sessionStorage The session |
||
51 | * @param string $username The username |
||
52 | * @param string $password The password |
||
53 | */ |
||
54 | 10 | public function __construct(Session $sessionStorage, $username, $password, Whitelist $whitelist) |
|
61 | |||
62 | /** |
||
63 | * Checks whether the user requires a login before being able to use the site |
||
64 | * |
||
65 | * @return boolean True when the site requires a login |
||
66 | */ |
||
67 | 3 | public function requiresLogin() |
|
71 | |||
72 | /** |
||
73 | * Checks whether the user is logged in |
||
74 | * |
||
75 | * @return boolean True when the user is logged in |
||
76 | */ |
||
77 | 4 | public function isLoggedIn() |
|
81 | |||
82 | /** |
||
83 | * Tries to log the user in |
||
84 | * |
||
85 | * @param string $username The user supplied username |
||
86 | * @param string $password The user supplied password |
||
87 | * @param string $ip The IP of the user |
||
88 | * |
||
89 | * @return boolean True when the user successfully authenticated |
||
90 | */ |
||
91 | 5 | public function login($username, $password, $ip) |
|
105 | } |
||
106 |