Example #1
0
 /**
  * @param \Modules\User\Models\User $user the user object
  * @return boolean whether the rule applies to the role
  */
 protected function isGroupMatched($user)
 {
     if (empty($this->groups)) {
         return true;
     }
     foreach ($this->groups as $key => $role) {
         if (is_numeric($key) && $user->can($role)) {
             return true;
         } else {
             if ($user->can($key, $role)) {
                 return true;
             }
         }
     }
     return false;
 }