Skip to content
Snippets Groups Projects
Commit 7bdeb341 authored by Arne Schröder, M. A.'s avatar Arne Schröder, M. A. Committed by André Noack
Browse files

Resolve "Anpassung der ILIAS-Schnittstelle für Nutzung mit ILIAS-seitiger...

Resolve "Anpassung der ILIAS-Schnittstelle für Nutzung mit ILIAS-seitiger LDAP/Shibboleth-Anbindung"
parent cab0b3ad
No related branches found
No related tags found
No related merge requests found
......@@ -134,6 +134,7 @@ class Admin_IliasInterfaceController extends AuthenticatedController
'url' => _('https://<URL zur ILIAS-Installation>'),
'client' => '',
'ldap_enable' => '',
'no_account_updates' => false,
'admin' => 'ilias_soap_admin',
'admin_pw' => '',
......@@ -211,7 +212,7 @@ class Admin_IliasInterfaceController extends AuthenticatedController
$this->ilias_config = $this->ilias_configs[$index];
$ldap_options = [];
foreach (StudipAuthAbstract::GetInstance() as $plugin) {
if ($plugin instanceof StudipAuthLdap) {
if (!($plugin instanceof StudipAuthStandard)) {
$ldap_options[] = '<option '.($plugin->plugin_name == $this->ilias_config['ldap_enable'] ? 'selected' : '').'>' . $plugin->plugin_name . '</option>';
}
}
......@@ -291,6 +292,7 @@ class Admin_IliasInterfaceController extends AuthenticatedController
if (Request::getInstance()->offsetExists('ilias_ldap_enable')) {
$this->ilias_configs[$index]['ldap_enable'] = Request::get('ilias_ldap_enable');
}
$this->ilias_configs[$index]['no_account_updates'] = Request::get('ilias_no_account_updates');
$this->ilias_configs[$index]['admin'] = Request::get('ilias_admin');
$this->ilias_configs[$index]['admin_pw'] = Request::get('ilias_admin_pw');
......
......@@ -85,7 +85,7 @@ class MyIliasAccountsController extends AuthenticatedController
PageLayout::setTitle($this->module->getTitle());
$this->ilias_index = $index;
} else {
PageLayout::postError(_("Diese ILIAS-Installation ist nicht aktiv."));
PageLayout::postError(_('Diese ILIAS-Installation ist nicht aktiv.'));
}
}
......@@ -100,7 +100,7 @@ class MyIliasAccountsController extends AuthenticatedController
$this->ilias_ref_id = $this->ilias->user->getCategory();
$this->ilias_index = $index;
} else {
PageLayout::postError(_("Diese ILIAS-Installation ist nicht aktiv."));
PageLayout::postError(_('Diese ILIAS-Installation ist nicht aktiv.'));
}
}
......@@ -131,7 +131,7 @@ class MyIliasAccountsController extends AuthenticatedController
case 'update' :
// update user account
if ($this->ilias->updateUser($GLOBALS['user'])) {
PageLayout::postSuccess(_("ILIAS-Account aktualisiert."));
PageLayout::postSuccess(_('ILIAS-Account aktualisiert.'));
}
break;
case 'add' :
......@@ -144,17 +144,17 @@ class MyIliasAccountsController extends AuthenticatedController
$this->ilias->user->setPassword('');
$this->ilias->user->setId($user_id);
$this->ilias->user->setConnection(IliasUser::USER_TYPE_ORIGINAL);
PageLayout::postSuccess(_("ILIAS-Account zugeordnet."));
PageLayout::postSuccess(_('ILIAS-Account zugeordnet.'));
$this->ilias->soap_client->clearCache();
}
} else {
// wrong login
PageLayout::postError(_("Login fehlgeschlagen. Die Zuordnung konnte nicht geändert werden."));
PageLayout::postError(_('Login fehlgeschlagen. Die Zuordnung konnte nicht geändert werden.'));
}
break;
case 'remove' :
$this->ilias->user->unsetConnection();
PageLayout::postSuccess(_("Account-Zuordnung entfernt."));
PageLayout::postSuccess(_('Account-Zuordnung entfernt.'));
break;
}
}
......@@ -177,16 +177,22 @@ class MyIliasAccountsController extends AuthenticatedController
$module_id = $this->ilias->user->category;
}
// display error message if session is invalid
if (!$session_id) {
PageLayout::postError(sprintf(_("Automatischer Login für %s-Installation (Nutzername %s) fehlgeschlagen."),
if (! $this->ilias->user->isConnected() && $this->ilias->ilias_config['no_account_updates']) {
PageLayout::postError(sprintf(
_('Sie haben im System %s noch keinen Account. Loggen Sie sich zuerst in %s ein, um ILIAS-Lernobjekte in Stud.IP nutzen zu können.'),
htmlReady($this->ilias->getName()),
'<a href="'.$this->ilias->getAbsolutePath().'">'.htmlReady($this->ilias->getName()).'</a>'
));
} elseif (!$session_id) {
PageLayout::postError(sprintf(_('Automatischer Login für %s-Installation (Nutzername %s) fehlgeschlagen.'),
htmlReady($this->ilias->getName()),
htmlReady($this->ilias->user->getUsername())));
} elseif (($target == 'new') AND ! $module_id) {
PageLayout::postError(sprintf(_("Keine Kategorie zum Anlegen neuer Lernobjekte in der %s-Installation vorhanden."),
PageLayout::postError(sprintf(_('Keine Kategorie zum Anlegen neuer Lernobjekte in der %s-Installation vorhanden.'),
htmlReady($this->ilias->getName())));
} else {
// remove client id from session id
$session_array = explode("::", $session_id);
$session_array = explode('::', $session_id);
$session_id = $session_array[0];
if (Request::get('ilias_module_type')) $module_type = Request::get('ilias_module_type');
......@@ -194,19 +200,19 @@ class MyIliasAccountsController extends AuthenticatedController
// build target link
$parameters = '?sess_id='.$session_id;
if (!empty($this->ilias->getClientId())) {
$parameters .= "&client_id=".$this->ilias->getClientId();
$parameters .= '&client_id='.$this->ilias->getClientId();
if ($target) {
$parameters .= "&target=".$target;
$parameters .= '&target='.$target;
}
if ($module_id) {
$parameters .= "&ref_id=".$module_id;
$parameters .= '&ref_id='.$module_id;
}
if ($module_type) {
$parameters .= "&type=".$module_type;
$parameters .= '&type='.$module_type;
}
// refer to ILIAS target file
header("Location: ". $this->ilias->getTargetFile() . $parameters);
header('Location: '. $this->ilias->getTargetFile() . $parameters);
$this->render_nothing();
}
}
......
......@@ -28,7 +28,7 @@
<span><?= _('Beim Löschen von Stud.IP-Accounts ILIAS-Accounts ebenfalls löschen (alle zugehörigen Objekte werden gelöscht!)') ?></span>
</label>
<label>
<span class="required"><?= _('Prefix für automatisch angelegte Usernamen') ?></span>
<span><?= _('Prefix für automatisch angelegte Usernamen') ?></span>
<? if ($ilias_config['is_active']) : ?>
<div><?=$ilias_config['user_prefix'] ? htmlReady($ilias_config['user_prefix']) : _('Kein Präfix')?></div>
<? else : ?>
......
......@@ -55,18 +55,22 @@
<? endif ?>
</label>
<label>
<span><?= _('LDAP-Einstellung') ?></span>
<span><?= _('Externe Authentifizierung') ?></span>
<? if ($ldap_options) : ?>
<select name="ilias_ldap_enable">
<?=$ldap_options;?>
</select><br>
<?=_("Authentifizierungsplugin (nur LDAP) beim Anlegen von externen Accounts übernehmen.");?>
<?=Icon::create('info-circle', 'inactive', ['title' => _("Wählen Sie hier ein Authentifizierungsplugin, damit neu angelegte ILIAS-Accounts den Authentifizierungsmodus LDAP erhalten, wenn dieser Modus auch für den vorhandenen Stud.IP-Account gilt. Andernfalls erhalten alle ILIAS-Accounts den default-Modus")])->asImg(16);?>
<?=_("Authentifizierungsplugin (nur LDAP/Shibboleth) beim Anlegen von externen Accounts übernehmen.");?>
<?=Icon::create('info-circle', 'inactive', ['title' => _("Wählen Sie hier ein Authentifizierungsplugin, damit neu angelegte ILIAS-Accounts den entsprechenden Authentifizierungsmodus erhalten, wenn dieser Modus auch für den vorhandenen Stud.IP-Account gilt. Andernfalls erhalten alle ILIAS-Accounts den default-Modus")])->asImg(16);?>
<? else : ?>
<br><?=_("(Um diese Einstellung zu nutzen muss zumindest ein LDAP Authentifizierungsplugin aktiviert sein.)");?>
<br><?=_("(Um diese Einstellung zu nutzen muss zumindest ein Authentifizierungsplugin aktiviert sein.)");?>
<input type="hidden" name="ilias_ldap_enable" value="">
<? endif ?>
</label>
<label>
<input type="checkbox" name="ilias_no_account_updates" value="1" <?= $ilias_config['no_account_updates'] ? 'checked' : '' ?>>
<span><?= _('Keine Accounts aus Stud.IP in ILIAS anlegen oder aktualisieren') ?></span>
</label>
<label>
<span class="required"> <?= _('Admin-Account') ?></span>
<input type="text" name="ilias_admin" size="50" maxlength="255" value="<?= $ilias_config['admin'] ?>" required>
......@@ -84,4 +88,4 @@
<? endif ?>
<?= Studip\Button::createCancel(_('Abbrechen'), 'cancel', ['data-dialog' => 'close']) ?>
</footer>
</form>
\ No newline at end of file
</form>
......@@ -98,6 +98,7 @@
</thead>
<tbody>
<? foreach($ilias_list as $ilias_index => $ilias) : ?>
<? if ($ilias->user->getUserName()) : ?>
<tr id="ilias-account-<?= htmlReady($ilias_index)?>">
<td><?=Icon::create('person', Icon::ROLE_INFO, [
'title' => $ilias->user->getUserName()
......@@ -143,6 +144,17 @@
<?= $actionMenu->render() ?>
</td>
</tr>
<? else : ?>
<tr>
<td colspan="4">
<?= sprintf(
_("Sie haben im System %s noch keinen Account. Loggen Sie sich zuerst in %s ein, um ILIAS-Lernobjekte in Stud.IP nutzen zu können."),
htmlReady($ilias->getName()),
"<a href=\"".$ilias->getAbsolutePath()."\">".htmlReady($ilias->getName())."</a>"
)?>
</td>
</tr>
<? endif ?>
<? endforeach ?>
</tbody>
</table>
......
......@@ -324,6 +324,7 @@ class ConnectedIlias
}
$user_data = $this->user->getUserArray();
$user_data["login"] = $this->ilias_config['user_prefix'].$user_data["login"];
$user_data['auth_mode'] = 'default';
$user_exists = $this->soap_client->lookupUser($user_data["login"]);
//automatische Zuordnung von bestehenden Ilias Accounts
......@@ -339,6 +340,14 @@ class ConnectedIlias
} elseif ($user_exists) {
$this->error[] = sprintf(_('Externer Account konnte nicht angelegt werden. Es existiert bereits ein User mit dem Login %s in %s'), $user_data["login"], $this->ilias_config['name']);
return false;
} elseif ($this->ilias_config['no_account_updates']) {
$this->error[] = sprintf(_('Sie haben noch keinen ILIAS-Account. Loggen Sie sich zuerst in %s ein, um ILIAS-Lernobjekte in Stud.IP nutzen zu können.'), "<a href=\"".$this->ilias_config['url']."\">".$this->ilias_config['name']."</a>");
return false;
} elseif (! $this->ilias_config['user_prefix'] &&
$this->ilias_config['ldap_enable'] &&
($this->user->auth_plugin != 'standard') &&
($this->user->auth_plugin == $this->ilias_config['ldap_enable'])) {
$user_data['external_account'] = $this->user->studip_login;
}
// set role according to Stud.IP perm
......@@ -376,6 +385,15 @@ class ConnectedIlias
return false;
}
$update_user = new IliasUser($this->index, $this->ilias_config['version'], $user->id);
// don't update ldap user
if (! $this->ilias_config['user_prefix'] &&
$this->ilias_config['ldap_enable'] &&
($update_user->auth_plugin != 'standard') &&
($update_user->auth_plugin == $this->ilias_config['ldap_enable'])) {
return true;
} elseif ($this->ilias_config['no_account_updates']) {
return true;
}
// if user is manually connected don't update user data
if ($update_user->getUserType() == IliasUser::USER_TYPE_ORIGINAL) {
return true;
......@@ -385,6 +403,7 @@ class ConnectedIlias
if ($update_user->isConnected() && $update_user->id && $this->soap_client->lookupUser($update_user->login)) {
$user_data = $update_user->getUserArray();
$user_data["login"] = $this->ilias_config['user_prefix'].$user_data["login"];
$user_data['auth_mode'] = 'default';
// set role according to Stud.IP perm
if ($user->perms == "root") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment