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); }
public function hasCredential($credential, $useAnd = true) { return parent::hasCredential($credential, $useAnd) || parent::hasPermission($credential); }
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); }