1 | <?php namespace Modules\User\Repositories\Usher; |
||
7 | class UsherAuthentication implements Authentication |
||
|
|||
8 | { |
||
9 | /** |
||
10 | * @var Guard |
||
11 | */ |
||
12 | private $guard; |
||
13 | |||
14 | /** |
||
15 | * @var UserRepository |
||
16 | */ |
||
17 | private $repository; |
||
18 | |||
19 | /** |
||
20 | * @param Guard $guard |
||
21 | * @param UserRepository $repository |
||
22 | */ |
||
23 | public function __construct(Guard $guard, UserRepository $repository) |
||
28 | |||
29 | /** |
||
30 | * Authenticate a user |
||
31 | * @param array $credentials |
||
32 | * @param bool $remember Remember the user |
||
33 | * @return mixed |
||
34 | */ |
||
35 | public function login(array $credentials, $remember = false) |
||
39 | |||
40 | /** |
||
41 | * Register a new user. |
||
42 | * @param array $user |
||
43 | * @return bool |
||
44 | */ |
||
45 | public function register(array $user) |
||
49 | |||
50 | /** |
||
51 | * Assign a role to the given user. |
||
52 | * @param \Modules\User\Repositories\UserRepository $user |
||
53 | * @param \Modules\User\Repositories\RoleRepository $role |
||
54 | * @return mixed |
||
55 | */ |
||
56 | public function assignRole($user, $role) |
||
60 | |||
61 | /** |
||
62 | * Log the user out of the application. |
||
63 | * @return bool |
||
64 | */ |
||
65 | public function logout() |
||
69 | |||
70 | /** |
||
71 | * Activate the given used id |
||
72 | * @param int $userId |
||
73 | * @param string $code |
||
74 | * @return mixed |
||
75 | */ |
||
76 | public function activate($userId, $code) |
||
80 | |||
81 | /** |
||
82 | * Create an activation code for the given user |
||
83 | * @param \Modules\User\Repositories\UserRepository $user |
||
84 | * @return mixed |
||
85 | */ |
||
86 | public function createActivation($user) |
||
90 | |||
91 | /** |
||
92 | * Create a reminders code for the given user |
||
93 | * @param \Modules\User\Repositories\UserRepository $user |
||
94 | * @return mixed |
||
95 | */ |
||
96 | public function createReminderCode($user) |
||
100 | |||
101 | /** |
||
102 | * Completes the reset password process |
||
103 | * @param $user |
||
104 | * @param string $code |
||
105 | * @param string $password |
||
106 | * @return bool |
||
107 | */ |
||
108 | public function completeResetPassword($user, $code, $password) |
||
112 | |||
113 | /** |
||
114 | * Determines if the current user has access to given permission |
||
115 | * @param $permission |
||
116 | * @return bool |
||
117 | */ |
||
118 | public function hasAccess($permission) |
||
122 | |||
123 | /** |
||
124 | * Check if the user is logged in |
||
125 | * @return mixed |
||
126 | */ |
||
127 | public function check() |
||
131 | } |
||
132 |