本文整理汇总了PHP中phpCAS::hasAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP phpCAS::hasAttribute方法的具体用法?PHP phpCAS::hasAttribute怎么用?PHP phpCAS::hasAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpCAS
的用法示例。
在下文中一共展示了phpCAS::hasAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setName
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();
}
}
示例2: __construct
/**
* 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));
}
}
}
示例3: UpdateUser
/**
* 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;
}