File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
app/base/abstracts/Controllers Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 2121use \App \App ;
2222use \App \Site \Routing \RouteInfo ;
2323use \App \Site \Models \GuestUser ;
24+ use \App \Site \Models \User ;
25+ use \App \Base \Abstracts \Models \AccountModel ;
2426
2527/**
2628 * Base for all controllers
@@ -76,6 +78,10 @@ public function getCurrentUser()
7678 return $ this ->getContainer ()->make (GuestUser::class);
7779 }
7880
81+ if ($ this ->current_user ->id ) {
82+ return $ this ->getContainer ()->call ([User::class, 'load ' ], ['id ' => $ this ->current_user ->id ]);
83+ }
84+
7985 return $ this ->current_user ;
8086 }
8187
@@ -118,7 +124,7 @@ public function renderPage(RouteInfo $route_info = null, $route_data = [])
118124 protected function checkPermission ($ permission_name )
119125 {
120126 try {
121- return $ this ->getCurrentUser () && $ this ->getCurrentUser ()->checkPermission ($ permission_name );
127+ return ( $ this ->getCurrentUser () instanceof AccountModel ) && $ this ->getCurrentUser ()->checkPermission ($ permission_name );
122128 } catch (\Exception $ e ) {
123129 $ this ->getUtils ()->logException ($ e );
124130 }
You can’t perform that action at this time.
0 commit comments