本文整理汇总了PHP中ilObjUser::_lookupAuthMode方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjUser::_lookupAuthMode方法的具体用法?PHP ilObjUser::_lookupAuthMode怎么用?PHP ilObjUser::_lookupAuthMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjUser
的用法示例。
在下文中一共展示了ilObjUser::_lookupAuthMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loginObserver
/**
* Called from fetchData after successful login.
*
* @param string username
*/
public function loginObserver($a_username, $a_auth)
{
$usr_id = ilObjUser::_lookupId($a_username);
$auth_mode = ilObjUser::_lookupAuthMode($usr_id);
$auth_id = ilAuthUtils::_getAuthMode($auth_mode);
$GLOBALS['ilLog']->write(__METHOD__ . ': auth id = ' . $auth_id);
switch ($auth_id) {
case AUTH_LOCAL:
return true;
default:
if (ilAuthUtils::isPasswordModificationEnabled($auth_id)) {
return true;
}
}
$a_auth->status = AUTH_WRONG_LOGIN;
$a_auth->logout();
return false;
}
示例2: handleEvent
/**
* Handle an event in a listener.
*
* @param string $a_component component, e.g. "Modules/Forum" or "Services/User"
* @param string $a_event event e.g. "createUser", "updateUser", "deleteUser", ...
* @param array $a_parameter parameter array (assoc), array("name" => ..., "phone_office" => ...)
*/
static function handleEvent($a_component, $a_event, $a_parameter)
{
global $ilLog;
$ilLog->write(__METHOD__ . ': Listening to event from: ' . $a_component);
switch ($a_component) {
case 'Services/User':
switch ($a_event) {
case 'afterCreation':
$user = $a_parameter['user_obj'];
$this->handleMembership($user);
break;
}
break;
case 'Modules/Course':
switch ($a_event) {
case 'addSubscriber':
case 'addParticipant':
if (ilObjUser::_lookupAuthMode($a_parameter['usr_id']) == 'ecs') {
if (!($user = ilObjectFactory::getInstanceByObjId($a_parameter['usr_id']))) {
$GLOBALS['ilLog']->write(__METHOD__ . ': No valid user found for usr_id ' . $a_parameter['usr_id']);
return true;
}
include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
$server_id = ilECSImport::lookupServerId($a_parameter['usr_id']);
$GLOBALS['ilLog']->write(__METHOD__ . ': Found server id: ' . $server_id);
include_once 'Services/WebServices/ECS/classes/class.ilECSSetting.php';
$settings = ilECSSetting::getInstanceByServerId($server_id);
$end = new ilDateTime(time(), IL_CAL_UNIX);
$end->increment(IL_CAL_MONTH, $settings->getDuration());
if ($user->getTimeLimitUntil() < $end->get(IL_CAL_UNIX)) {
$user->setTimeLimitUntil($end->get(IL_CAL_UNIX));
$user->update();
}
self::_sendNotification($settings, $user);
unset($user);
}
break;
}
break;
}
}
示例3: testAuthAndEmailMethods
/**
* Auth and email related methods
* @group IL_Init
*/
public function testAuthAndEmailMethods()
{
include_once "./Services/User/classes/class.ilObjUser.php";
$value = "";
// creation
$user = new ilObjUser();
$d = array("login" => "aatestuser2", "passwd_type" => IL_PASSWD_PLAIN, "passwd" => "password", "gender" => "f", "firstname" => "Heidi", "lastname" => "Kabel", "email" => "qwe@ty.de", "ext_account" => "ext_");
$user->assignData($d);
$user->setActive(true);
$user->create();
$user->saveAsNew();
$user->setLanguage("de");
$user->writePrefs();
$id = $user->getId();
ilObjUser::_writeExternalAccount($id, "ext_kabel");
ilObjUser::_writeAuthMode($id, "cas");
$ids = ilObjUser::_getUserIdsByEmail("qwe@ty.de");
//var_dump($ids);
if (is_array($ids) && count($ids) == 1 && $ids[0] == "aatestuser2") {
$value .= "email1-";
}
$uid = ilObjUser::getUserIdByEmail("qwe@ty.de");
if ($uid == $id) {
$value .= "email2-";
}
$acc = ilObjUser::_getExternalAccountsByAuthMode("cas");
foreach ($acc as $k => $v) {
if ($k == $id && $v == "ext_kabel") {
$value .= "auth1-";
}
}
if (ilObjUser::_lookupAuthMode($id) == "cas") {
$value .= "auth2-";
}
if (ilObjUser::_checkExternalAuthAccount("cas", "ext_kabel") == "aatestuser2") {
$value .= "auth3-";
}
if (ilObjUser::_externalAccountExists("ext_kabel", "cas")) {
$value .= "auth4-";
}
ilObjUser::_getNumberOfUsersPerAuthMode();
$la = ilObjUser::_getLocalAccountsForEmail("qwe@ty.de");
ilObjUser::_incrementLoginAttempts($id);
ilObjUser::_getLoginAttempts($id);
ilObjUser::_resetLoginAttempts($id);
ilObjUser::_setUserInactive($id);
// deletion
$user->delete();
$this->assertEquals("email1-email2-auth1-auth2-auth3-auth4-", $value);
}
示例4: handleEvent
/**
* Handle an event in a listener.
*
* @param string $a_component component, e.g. "Modules/Forum" or "Services/User"
* @param string $a_event event e.g. "createUser", "updateUser", "deleteUser", ...
* @param array $a_parameter parameter array (assoc), array("name" => ..., "phone_office" => ...)
*/
static function handleEvent($a_component, $a_event, $a_parameter)
{
global $ilLog;
$ilLog->write(__METHOD__ . ': Listening to event from: ' . $a_component . ' ' . $a_event);
switch ($a_component) {
case 'Services/User':
switch ($a_event) {
case 'afterCreate':
$user = $a_parameter['user_obj'];
self::handleMembership($user);
break;
}
break;
case 'Modules/Group':
$GLOBALS['ilLog']->write(__METHOD__ . ': New event from group: ' . $a_event);
switch ($a_event) {
case 'addSubscriber':
case 'addToWaitingList':
if (ilObjUser::_lookupAuthMode($a_parameter['usr_id']) == 'ecs') {
if (!($user = ilObjectFactory::getInstanceByObjId($a_parameter['usr_id']))) {
$GLOBALS['ilLog']->write(__METHOD__ . ': No valid user found for usr_id ' . $a_parameter['usr_id']);
return true;
}
$settings = self::initServer($a_parameter['usr_id']);
self::extendAccount($settings, $user);
include_once './Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatus.php';
self::updateEnrolmentStatus($a_parameter['obj_id'], $user, ilECSEnrolmentStatus::STATUS_PENDING);
}
break;
case 'deleteParticipant':
if (ilObjUser::_lookupAuthMode($a_parameter['usr_id']) == 'ecs') {
if (!($user = ilObjectFactory::getInstanceByObjId($a_parameter['usr_id']))) {
$GLOBALS['ilLog']->write(__METHOD__ . ': No valid user found for usr_id ' . $a_parameter['usr_id']);
return true;
}
include_once './Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatus.php';
self::updateEnrolmentStatus($a_parameter['obj_id'], $user, ilECSEnrolmentStatus::STATUS_UNSUBSCRIBED);
}
break;
case 'addParticipant':
if (ilObjUser::_lookupAuthMode($a_parameter['usr_id']) == 'ecs') {
if (!($user = ilObjectFactory::getInstanceByObjId($a_parameter['usr_id']))) {
$GLOBALS['ilLog']->write(__METHOD__ . ': No valid user found for usr_id ' . $a_parameter['usr_id']);
return true;
}
$settings = self::initServer($user->getId());
self::extendAccount($settings, $user);
#self::_sendNotification($settings,$user);
include_once './Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatus.php';
self::updateEnrolmentStatus($a_parameter['obj_id'], $user, ilECSEnrolmentStatus::STATUS_ACTIVE);
unset($user);
}
break;
}
break;
case 'Modules/Course':
$GLOBALS['ilLog']->write(__METHOD__ . ': New event from course: ' . $a_event);
switch ($a_event) {
case 'addSubscriber':
case 'addToWaitingList':
if (ilObjUser::_lookupAuthMode($a_parameter['usr_id']) == 'ecs') {
if (!($user = ilObjectFactory::getInstanceByObjId($a_parameter['usr_id']))) {
$GLOBALS['ilLog']->write(__METHOD__ . ': No valid user found for usr_id ' . $a_parameter['usr_id']);
return true;
}
$settings = self::initServer($a_parameter['usr_id']);
self::extendAccount($settings, $user);
include_once './Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatus.php';
self::updateEnrolmentStatus($a_parameter['obj_id'], $user, ilECSEnrolmentStatus::STATUS_PENDING);
}
break;
case 'deleteParticipant':
if (ilObjUser::_lookupAuthMode($a_parameter['usr_id']) == 'ecs') {
if (!($user = ilObjectFactory::getInstanceByObjId($a_parameter['usr_id']))) {
$GLOBALS['ilLog']->write(__METHOD__ . ': No valid user found for usr_id ' . $a_parameter['usr_id']);
return true;
}
include_once './Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatus.php';
self::updateEnrolmentStatus($a_parameter['obj_id'], $user, ilECSEnrolmentStatus::STATUS_UNSUBSCRIBED);
}
break;
case 'addParticipant':
if (ilObjUser::_lookupAuthMode($a_parameter['usr_id']) == 'ecs') {
if (!($user = ilObjectFactory::getInstanceByObjId($a_parameter['usr_id']))) {
$GLOBALS['ilLog']->write(__METHOD__ . ': No valid user found for usr_id ' . $a_parameter['usr_id']);
return true;
}
$settings = self::initServer($user->getId());
self::extendAccount($settings, $user);
self::_sendNotification($settings, $user);
include_once './Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatus.php';
self::updateEnrolmentStatus($a_parameter['obj_id'], $user, ilECSEnrolmentStatus::STATUS_ACTIVE);
unset($user);
//.........这里部分代码省略.........