Example #1
0
 public function hasCredential($credential, $useAnd = true)
 {
     if (!$this->getGuardUser()) {
         return false;
     }
     $allPermissions = $this->getGuardUser()->getAllPermissions();
     if ($allPermissions[$credential]) {
         return true;
     }
     return parent::hasCredential($credential, $useAnd);
 }
Example #2
0
 public function hasCredential($credential, $useAnd = true)
 {
     return parent::hasCredential($credential, $useAnd) || parent::hasPermission($credential);
 }
Example #3
0
 public function hasCredential($credential, $useAnd = true)
 {
     if ($this->isAuthenticated() && $this->getGuardUser()) {
         if ($this->hasAttribute(self::SESSION_LAST_PERMISSION_CHECK)) {
             if ($this->getAttribute(self::SESSION_LAST_PERMISSION_CHECK) != $this->getGuardUser()->getUpdatedAt()) {
                 $this->setAuthenticated(true);
                 $this->clearCredentials();
                 $this->addCredentials($this->getGuardUser()->getAllPermissionNames());
                 $this->setAttribute(self::SESSION_LAST_PERMISSION_CHECK, $this->getGuardUser()->getUpdatedAt());
             }
         } else {
             $this->setAttribute(self::SESSION_LAST_PERMISSION_CHECK, $this->getGuardUser()->getUpdatedAt());
         }
     }
     return parent::hasCredential($credential, $useAnd);
 }