forked from FranckDevops/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: gestion des permissions via active directoy
- ajout de nouveaux paramètres de configuration pour géré le mapping - création d'une interface utilisateur pour le mapping - synchronisation des groupes AD avec moodle - mise en place d'une tâche cron
- Loading branch information
Showing
10 changed files
with
494 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
/** | ||
* User interface for mappings | ||
* | ||
* @package auth_nyxei | ||
* @copyright 2024 Nyx-EI {@link https://nyx-ei.tech} | ||
* @author NYX-EI <help@nyx-ei.tech> | ||
*/ | ||
|
||
require_once('../../config.php'); | ||
|
||
require_login(); | ||
admin_externalpage_setup('auth_nyxei_settings'); | ||
|
||
if (!has_capability('moodle/site:config', context_system::instance())) { | ||
print_error('nopermissions', 'error', '', 'access this page'); | ||
} | ||
|
||
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['ad_group_role_mappings'])) { | ||
$mappings = trim($_POST['ad_group_role_mappings']); | ||
set_config('ad_group_role_mappings', $mappings, 'auth_nyxei'); | ||
echo '<div class="alert alert-success">Mappings saved successfully!</div>'; | ||
} | ||
|
||
echo $OUTPUT->header(); | ||
echo '<h2>' . get_string('ad_group_role_mappings', 'auth_nyxei') . '</h2>'; | ||
|
||
$current_mappings = get_config('auth_nyxei', 'ad_group_role_mappings'); | ||
echo '<form method="post">'; | ||
echo '<textarea name="ad_group_role_mappings" rows="10" cols="50">' . s($current_mappings) . '</textarea>'; | ||
echo '<br><br>'; | ||
echo '<input type="submit" value="' . get_string('savechanges') . '" class="btn btn-primary">'; | ||
echo '</form>'; | ||
|
||
// Affiche le pied de page | ||
echo $OUTPUT->footer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/** | ||
* A scheduled task for AD groups roles sync. | ||
* | ||
* @package auth_nyxei | ||
* @author NYX-EI <help@nyx-ei.tech> | ||
* @copyright 2024 Nyx-EI <help@nyx-ei.tech> | ||
*/ | ||
|
||
namespace auth_nyxei\task; | ||
|
||
global $CFG; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
|
||
require_once($CFG->dirroot.'/auth/nyxei/auth.php'); | ||
|
||
class sync_ad_groups extends \core\task\scheduled_task { | ||
|
||
public function get_name() | ||
{ | ||
return get_string('sync_ad_groups', 'auth_nyxei'); | ||
} | ||
|
||
public function execute() { | ||
$auth = get_auth_plugin('nyxei'); | ||
$auth->sync_ad_groups_to_roles(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.