File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,12 @@ public function hasPermission(string $permission): bool
233233 */
234234 public function can (string ...$ permissions ): bool
235235 {
236+ // Get user's permissions and store in cache
237+ $ this ->populatePermissions ();
238+
239+ // Check the groups the user belongs to
240+ $ this ->populateGroups ();
241+
236242 foreach ($ permissions as $ permission ) {
237243 // Permission must contain a scope and action
238244 if (strpos ($ permission , '. ' ) === false ) {
@@ -242,18 +248,13 @@ public function can(string ...$permissions): bool
242248 );
243249 }
244250
245- $ this ->populatePermissions ();
246-
247251 $ permission = strtolower ($ permission );
248252
249253 // Check user's permissions
250254 if (in_array ($ permission , $ this ->permissionsCache , true )) {
251255 return true ;
252256 }
253257
254- // Check the groups the user belongs to
255- $ this ->populateGroups ();
256-
257258 if (! count ($ this ->groupCache )) {
258259 return false ;
259260 }
You can’t perform that action at this time.
0 commit comments