Skip to content

Commit

Permalink
Fix #43 Reset values to factory settings option doesn't work. Add dis…
Browse files Browse the repository at this point in the history
…able JiT option
  • Loading branch information
root committed Apr 18, 2016
1 parent b4cb05e commit 1783535
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 2 deletions.
6 changes: 5 additions & 1 deletion auth/saml/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ function process_config($config) {
$dbman = $DB->get_manager();

if(isset($config->auth_saml_db_reset)) {
$sql = "DELETE FROM ".$CFG->prefix."config_plugins WHERE plugin = 'auth/saml';";
$sql = "DELETE FROM ".$CFG->prefix."config_plugins WHERE plugin = 'auth/saml'";
try {
$DB->execute($sql);
}
Expand Down Expand Up @@ -387,6 +387,9 @@ function process_config($config) {
if (!isset ($config->externalrolemappingsql)) {
$config->externalrolemappingsql = '';
}
if (!isset ($config->disablejit)) {
$config->disablejit = false;
}

// Save saml settings in a file
$saml_param_encoded = json_encode($saml_param);
Expand All @@ -409,6 +412,7 @@ function process_config($config) {
set_config('samlhookfile', $config->samlhookfile, 'auth/saml');
set_config('moodlecoursefieldid', $config->moodlecoursefieldid, 'auth/saml');
set_config('ignoreinactivecourses', $config->ignoreinactivecourses, 'auth/saml');
set_config('disablejit', $config->disablejit, 'auth/saml');

if($config->supportcourses == 'external') {
set_config('externalcoursemappingdsn', $config->externalcoursemappingdsn, 'auth/saml');
Expand Down
12 changes: 12 additions & 0 deletions auth/saml/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@
$config->externalrolemappingsql = '';
}

if (!isset ($config->disablejit)) {
$config->disablejit = false;
}

?>

<div align="right">
Expand Down Expand Up @@ -255,6 +259,14 @@
<td><?php print_string("auth_saml_supportcourses_description", "auth_saml"); ?></td>
</tr>

<tr valign="top">
<td class="right"><?php print_string("auth_saml_disablejit", "auth_saml"); ?>:</td>
<td>
<input name="disablejit" type="checkbox" <?php if($config->disablejit) echo 'checked="CHECKED"'; ?> />
</td>
<td><?php print_string("auth_saml_disablejit_description", "auth_saml"); ?></td>
</tr>

<tr valign="top">
<td class="right"><?php print_string('auth_saml_syncusersfrom', 'auth_saml'); ?>:</td>
<td>
Expand Down
6 changes: 6 additions & 0 deletions auth/saml/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@
$user_exists = $user_exists && saml_hook_user_exists($username, $saml_attributes, $user_exists);
}

if (!$user_exists && $pluginconfig->disablejit) {
$jit_not_active = get_string("auth_saml_jit_not_active", "auth_saml", $username);
$err['login'] = "<p>". $jit_not_active . "</p>";
auth_saml_error($err, '?logout', $pluginconfig->samllogfile);
}

$authorize_user = true;
$authorize_error = '';

Expand Down
8 changes: 7 additions & 1 deletion auth/saml/lang/en/auth_saml.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$string['auth_saml_errorsp_source'] = "SimpleSAMLPHP sp source {\$a} is not correct";

$string['auth_saml_db_reset_button'] = 'Reset values to factory settings';
$string['auth_saml_db_reset_error'] = 'Error reseting the saml plugin values';
$string['auth_saml_db_reset_error'] = 'Error resetting the saml plugin values';

$string['auth_saml_form_error'] = 'It seems there are some errors in the form. Please, see below for correcting them';

Expand All @@ -28,6 +28,10 @@
$string['auth_saml_supportcourses'] = 'SAML support courses';
$string['auth_saml_supportcourses_description'] = 'Select Internal or External to have Moodle auto enrol users in courses (Use External if your course/role mapping is in an external DB)';


$string['auth_saml_disablejit'] = "Just-In-Time Provisioning";
$string['auth_saml_disablejit_description'] = "Check it in order to disable the just-in-time provisioning. When jit is disabled, account will be not created";

$string['auth_saml_syncusersfrom'] = 'Syncronize users from module';
$string['auth_saml_syncusersfrom_description'] = 'Syncronize users into Moodle using another module. The users will be created with auth = \'saml\', even though they are actually synchronized by another module.
This allows you to create, update and delete users from for example LDAP, but log them in via SAML. Note that the module you wish to sync from must be enabled, and all sync settings should be controlled from that module, not from SAML.
Expand All @@ -53,6 +57,8 @@
$string['auth_saml_ignoreinactivecourses'] = 'Ignore Inactive Courses';
$string['auth_saml_ignoreinactivecourses_description'] = "If not checked the plugin will unenroll the 'inactive' courses";

$string['auth_saml_jit_not_active'] = "User account {\$a} does not exists and just-in-time provisioning is disabled";

$string['auth_saml_not_authorize'] = "{\$a} has no active CAV course. ";

$string['auth_saml_error_executing'] = "Error executing ";
Expand Down
6 changes: 6 additions & 0 deletions auth/saml/lang/es/auth_saml.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@

$string['auth_saml_not_authorize'] = "{\$a} no tiene activo ningún curso del Campus Andaluz Virtual";

$string['auth_saml_jit_not_active'] = "La cuenta {\$a} no existe y la provisión automática de usuarios está desabilitada";

$string['auth_saml_disablejit'] = "Provisiomiento automático";
$string['auth_saml_disablejit_description'] = "Marcalo para desabilitar el 'just-in-time provisioning', en cuyo caso las cuentas no serán creadas automáticamente";


$string['auth_saml_error_executing'] = "Error al ejecutar ";

$string['auth_saml_mapping_dsn_description'] = 'Cadena del Nombre del Origen de Datos (dsn) para conectar con la base de datos de la asignación de cursos/roles.
Expand Down
4 changes: 4 additions & 0 deletions auth/saml/lang/es_es/auth_saml.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@

$string['auth_saml_not_authorize'] = "{\$a} no tiene activo ningún curso del Campus Andaluz Virtual";

$string['auth_saml_jit_not_active'] = "La cuenta {\$a} no existe y la provisión automática de usuarios está desabilitada";
$string['auth_saml_disablejit'] = "Provisiomiento automático";
$string['auth_saml_disablejit_description'] = "Marcalo para desabilitar el 'just-in-time provisioning', en cuyo caso las cuentas no serán creadas automáticamente";

$string['auth_saml_error_executing'] = "Error al ejecutar ";

$string['auth_saml_mapping_dsn_description'] = 'Cadena del Nombre del Origen de Datos (dsn) para conectar con la base de datos de la asignación de cursos/roles.
Expand Down

0 comments on commit 1783535

Please sign in to comment.