Beispiel #1
0
 /**
  * @param \App\Libraries\Acl\Interfaces\UserRestrictionInterface $model
  * @param \App\User|null                                         $user
  * @param array                                                  $parameters
  *
  * @return bool
  */
 public function isUserAllowModel(UserRestrictionInterface $model, \App\User $user = null, array $parameters = [])
 {
     // no user is given, we take the current user
     if (is_null($user)) {
         $user = Auth::user();
     }
     // no current user and no user given, no access
     if (is_null($user)) {
         return false;
     }
     if ($user->isSuperAdmin()) {
         return true;
     }
     return $model->isUserAllow($user, $parameters);
 }
 /**
  * @param \App\Libraries\Acl\Interfaces\UserRestrictionInterface $model
  * @param array                                                  $parameters
  *
  * @return mixed
  */
 public function canUse(\App\Libraries\Acl\Interfaces\UserRestrictionInterface $model, array $parameters = [])
 {
     return $model->isUserAllow($this, $parameters);
 }