Skip to content

Commit

Permalink
Make codechecker happy again
Browse files Browse the repository at this point in the history
  • Loading branch information
abias committed Oct 14, 2023
1 parent 6dc3bc7 commit 9566740
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changes

### Unreleased

* 2023-10-14 - Make codechecker happy again
* 2023-10-10 - Updated Moodle Plugin CI to latest upstream recommendations
* 2023-04-30 - Tests: Updated Moodle Plugin CI to use PHP 8.1 and Postgres 13 from Moodle 4.1 on.

Expand Down
2 changes: 1 addition & 1 deletion classes/task/sync_roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function execute() {
global $DB;
if (is_enabled_auth('ldap_syncplus')) {
$auth = get_auth_plugin('ldap_syncplus');
$users = $DB->get_records('user', array('auth' => 'ldap_syncplus'));
$users = $DB->get_records('user', ['auth' => 'ldap_syncplus']);
foreach ($users as $user) {
$auth->sync_roles($user);
}
Expand Down
8 changes: 4 additions & 4 deletions db/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

defined('MOODLE_INTERNAL') || die();

$observers = array(
array(
$observers = [
[
'eventname' => '\core\event\user_created',
'includefile' => '/auth/ldap_syncplus/eventhandler.php',
'callback' => 'update_user_onevent',
),
);
],
];
16 changes: 8 additions & 8 deletions db/tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@

defined('MOODLE_INTERNAL') || die();

$tasks = array(
array(
$tasks = [
[
'classname' => 'auth_ldap_syncplus\task\sync_roles',
'blocking' => 0,
'minute' => '0',
'hour' => '0',
'day' => '*',
'month' => '*',
'dayofweek' => '*',
'disabled' => 1
),
array(
'disabled' => 1,
],
[
'classname' => 'auth_ldap_syncplus\task\sync_task',
'blocking' => 0,
'minute' => '0',
'hour' => '0',
'day' => '*',
'month' => '*',
'dayofweek' => '*',
'disabled' => 1
)
);
'disabled' => 1,
],
];
2 changes: 1 addition & 1 deletion eventhandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function update_user_onevent($eventdata) {
if (!empty($eventdata->relateduserid)) {

// Get user data.
$user = $DB->get_record('user', array('id' => $eventdata->relateduserid));
$user = $DB->get_record('user', ['id' => $eventdata->relateduserid]);

// Do if user was found.
if (!empty($user->username)) {
Expand Down
22 changes: 11 additions & 11 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@
get_string('auth_ldap_host_url', 'auth_ldap'), '', PARAM_RAW_TRIMMED));

// Version.
$versions = array();
$versions = [];
$versions[2] = '2';
$versions[3] = '3';
$settings->add(new admin_setting_configselect('auth_ldap_syncplus/ldap_version',
new lang_string('auth_ldap_version_key', 'auth_ldap'),
new lang_string('auth_ldap_version', 'auth_ldap'), 3, $versions));

// Start TLS.
$yesno = array(
$yesno = [
new lang_string('no'),
new lang_string('yes'),
);
];
$settings->add(new admin_setting_configselect('auth_ldap_syncplus/start_tls',
new lang_string('start_tls_key', 'auth_ldap'),
new lang_string('start_tls', 'auth_ldap'), 0 , $yesno));
Expand Down Expand Up @@ -123,7 +123,7 @@
new lang_string('auth_ldap_search_sub', 'auth_ldap'), 0 , $yesno));

// Dereference aliases.
$optderef = array();
$optderef = [];
$optderef[LDAP_DEREF_NEVER] = get_string('no');
$optderef[LDAP_DEREF_ALWAYS] = get_string('yes');

Expand Down Expand Up @@ -171,7 +171,7 @@
get_string('stdchangepassword_explldap', 'auth'), 0 , $yesno));

// Password Type.
$passtype = array();
$passtype = [];
$passtype['plaintext'] = get_string('plaintext', 'auth');
$passtype['md5'] = get_string('md5', 'auth');
$passtype['sha1'] = get_string('sha1', 'auth');
Expand Down Expand Up @@ -200,7 +200,7 @@
$description = new lang_string('auth_ldap_expiration_desc', 'auth_ldap', $langobject);

// Now create the options.
$expiration = array();
$expiration = [];
$expiration['0'] = $strno;
$expiration['1'] = $strldapserver;

Expand Down Expand Up @@ -261,9 +261,9 @@
// If we were to manipulate the setting name by removing the hyphens we may get conflicts, eg
// 'thisisashortname' and 'this-is-a-short-name'. The same applies for shortening the setting name.
if (core_text::strlen($role['settingname']) > 100 || !preg_match('/^[a-zA-Z0-9_]+$/', $role['settingname'])) {
$url = new moodle_url('/admin/roles/define.php', array('action' => 'edit', 'roleid' => $role['id']));
$url = new moodle_url('/admin/roles/define.php', ['action' => 'edit', 'roleid' => $role['id']]);
$a = (object)['rolename' => $role['localname'], 'shortname' => $role['shortname'], 'charlimit' => 93,
'link' => $url->out()];
'link' => $url->out(), ];
$settings->add(new admin_setting_heading('auth_ldap_syncplus/role_not_mapped_' . sha1($role['settingname']), '',
get_string('cannotmaprole', 'auth_ldap', $a)));
} else {
Expand All @@ -278,7 +278,7 @@
new lang_string('auth_sync_script', 'auth'), ''));

// Remove external user.
$deleteopt = array();
$deleteopt = [];
$deleteopt[AUTH_REMOVEUSER_KEEP] = get_string('auth_remove_keep', 'auth');
$deleteopt[AUTH_REMOVEUSER_SUSPEND] = get_string('auth_remove_suspend', 'auth');
$deleteopt[AUTH_REMOVEUSER_FULLDELETE] = get_string('auth_remove_delete', 'auth');
Expand Down Expand Up @@ -318,7 +318,7 @@
get_string('auth_ntlmsso_subnet', 'auth_ldap'), '', PARAM_RAW_TRIMMED));

// NTLM Fast Path.
$fastpathoptions = array();
$fastpathoptions = [];
$fastpathoptions[AUTH_NTLM_FASTPATH_YESFORM] = get_string('auth_ntlmsso_ie_fastpath_yesform', 'auth_ldap');
$fastpathoptions[AUTH_NTLM_FASTPATH_YESATTEMPT] = get_string('auth_ntlmsso_ie_fastpath_yesattempt', 'auth_ldap');
$fastpathoptions[AUTH_NTLM_FASTPATH_ATTEMPT] = get_string('auth_ntlmsso_ie_fastpath_attempt', 'auth_ldap');
Expand All @@ -329,7 +329,7 @@
AUTH_NTLM_FASTPATH_ATTEMPT, $fastpathoptions));

// Authentication type.
$types = array();
$types = [];
$types['ntlm'] = 'NTLM';
$types['kerberos'] = 'Kerberos';

Expand Down
2 changes: 1 addition & 1 deletion tests/behat/behat_auth_ldap_syncplus.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function i_pretend_that_the_suspended_user_was_already_suspended_days_ago
global $DB;

// Get the user record of the given user.
$user = $DB->get_record('user', array('username' => $username));
$user = $DB->get_record('user', ['username' => $username]);

// Update the suspended field in the user record.
$user->suspended = 1;
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
$plugin->requires = 2022112800;
$plugin->supported = [401, 401];
$plugin->maturity = MATURITY_STABLE;
$plugin->dependencies = array('auth_ldap' => 2022041900);
$plugin->dependencies = ['auth_ldap' => 2022041900];

0 comments on commit 9566740

Please sign in to comment.