File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -63,17 +63,20 @@ public function getTitleDetails(): string
6363 public function display (): string
6464 {
6565 if ($ this ->auth ->loggedIn ()) {
66- $ user = $ this ->auth ->user ();
67- $ groups = $ user ->getGroups ();
66+ $ user = $ this ->auth ->user ();
67+ $ groups = $ user ->getGroups ();
68+ $ permissions = $ user ->getPermissions ();
6869
69- $ groupsForUser = implode (', ' , $ groups );
70+ $ groupsForUser = implode (', ' , $ groups );
71+ $ permissionsForUser = implode (', ' , $ permissions );
7072
7173 $ html = '<h3>Current User</h3> ' ;
7274 $ html .= '<table><tbody> ' ;
7375 $ html .= "<tr><td style='width:150px;'>User ID</td><td># {$ user ->id }</td></tr> " ;
7476 $ html .= "<tr><td>Username</td><td> {$ user ->username }</td></tr> " ;
7577 $ html .= "<tr><td>Email</td><td> {$ user ->email }</td></tr> " ;
7678 $ html .= "<tr><td>Groups</td><td> {$ groupsForUser }</td></tr> " ;
79+ $ html .= "<tr><td>Permissions</td><td> {$ permissionsForUser }</td></tr> " ;
7780 $ html .= '</tbody></table> ' ;
7881 } else {
7982 $ html = '<p>Not logged in.</p> ' ;
Original file line number Diff line number Diff line change @@ -161,8 +161,9 @@ class Auth extends BaseConfig
161161 * Magic Link Lifetime
162162 * --------------------------------------------------------------------
163163 * Specifies the amount of time, in seconds, that a magic link is valid.
164+ * You can use Time Constants or any desired number.
164165 */
165- public int $ magicLinkLifetime = 1 * HOUR ;
166+ public int $ magicLinkLifetime = HOUR ;
166167
167168 /**
168169 * --------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -43,12 +43,14 @@ public function testDisplayLoggedIn(): void
4343 assert ($ authenticator instanceof Session);
4444 $ authenticator ->login ($ this ->user );
4545 $ this ->user ->addGroup ('admin ' , 'beta ' );
46+ $ this ->user ->addPermission ('users.create ' , 'users.edit ' );
4647
4748 $ output = $ this ->collector ->display ();
4849
4950 $ this ->assertStringContainsString ('Current Use ' , $ output );
5051 $ this ->assertStringContainsString ('<td>Username</td><td>John Smith</td> ' , $ output );
5152 $ this ->assertStringContainsString ('<td>Groups</td><td>admin, beta</td> ' , $ output );
53+ $ this ->assertStringContainsString ('<td>Permissions</td><td>users.create, users.edit</td> ' , $ output );
5254 }
5355
5456 public function testDisplayNotLoggedInAfterLogout (): void
You can’t perform that action at this time.
0 commit comments