hasAttribute() public static method

Answer true if an attribute exists for the authenticated user.
public static hasAttribute ( string $key ) : boolean
$key string attribute name
return boolean
Beispiel #1
0
 private function setName()
 {
     if ($this->config->get('cas-name-attribute-key') !== null && phpCAS::hasAttribute($this->config->get('cas-name-attribute-key'))) {
         $_SESSION[':cas']['name'] = phpCAS::getAttribute($this->config->get('cas-name-attribute-key'));
     } else {
         $_SESSION[':cas']['name'] = $this->getUser();
     }
 }
Beispiel #2
0
 /**
  * Constructor
  *
  * @param AuthenticationAuthority $AuthenticationAuthority
  * @return void
  */
 public function __construct(AuthenticationAuthority $AuthenticationAuthority)
 {
     parent::__construct($AuthenticationAuthority);
     if (!phpCAS::isAuthenticated()) {
         phpCAS::forceAuthentication();
     }
     $this->setUserID(phpCAS::getUser());
     if (!method_exists('phpCAS', 'getAttribute')) {
         throw new KurogoConfigurationException('CASAuthentication attribute mapping requires phpCAS 1.2.0 or greater.');
     }
     foreach (self::$attributeMap as $property => $attribute) {
         if (phpCAS::hasAttribute($attribute)) {
             $method = 'set' . $property;
             $this->{$method}(phpCAS::getAttribute($property));
         }
     }
 }
 /**
  * Called after the user has been authenticated and found in iTop. This method can
  * Update the user's definition (profiles...) on the fly to keep it in sync with an external source 
  * @param User $oUser The user to update/synchronize
  * @param string $sLoginMode The login mode used (cas|form|basic|url)
  * @param string $sAuthentication The authentication method used
  * @return void
  */
 public static function UpdateUser(User $oUser, $sLoginMode, $sAuthentication)
 {
     $bCASUpdateProfiles = MetaModel::GetConfig()->Get('cas_update_profiles');
     if ($sLoginMode == 'cas' && $bCASUpdateProfiles && phpCAS::hasAttribute('memberOf')) {
         $aMemberOf = phpCAS::getAttribute('memberOf');
         if (!is_array($aMemberOf)) {
             $aMemberOf = array($aMemberOf);
         }
         // Just one entry, turn it into an array
         return self::SetProfilesFromCAS($oUser, $aMemberOf);
     }
     // No groups defined in CAS or not CAS at all: do nothing...
     return true;
 }