예제 #1
0
파일: Acl.php 프로젝트: ndrx-io/elude
 /**
  * @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);
 }
예제 #2
0
 /**
  * @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);
 }