forked from LafColITS/Moodle-auth_casattras
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.php
110 lines (92 loc) · 5.11 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Admin settings and defaults.
*
* @package auth_casattras
* @copyright 2019 Lafayette College ITS
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
// CAS server configuration label.
$settings->add(new admin_setting_heading('auth_casattras/pluginname', '',
new lang_string('auth_casattras_server_settings', 'auth_casattras')));
// Authentication method name.
$settings->add(new admin_setting_configtext('auth_casattras/auth_name',
new lang_string('auth_casattras_auth_name', 'auth_casattras'),
new lang_string('auth_casattras_auth_name_description', 'auth_casattras'),
new lang_string('auth_casattras_auth_service', 'auth_casattras'),
PARAM_RAW_TRIMMED));
// Authentication method logo.
$opts = array('accepted_types' => array('.png', '.jpg', '.gif', '.webp', '.tiff', '.svg'));
$settings->add(new admin_setting_configstoredfile('auth_casattras/auth_logo',
new lang_string('auth_casattras_auth_logo', 'auth_casattras'),
new lang_string('auth_casattras_auth_logo_description', 'auth_casattras'), 'logo', 0, $opts));
// Hostname.
$settings->add(new admin_setting_configtext('auth_casattras/hostname',
new lang_string('auth_casattras_hostname_key', 'auth_casattras'),
new lang_string('auth_casattras_hostname', 'auth_casattras'), '', PARAM_RAW_TRIMMED));
// Base URI.
$settings->add(new admin_setting_configtext('auth_casattras/baseuri',
new lang_string('auth_casattras_baseuri_key', 'auth_casattras'),
new lang_string('auth_casattras_baseuri', 'auth_casattras'), '', PARAM_RAW_TRIMMED));
// Port.
$settings->add(new admin_setting_configtext('auth_casattras/port',
new lang_string('auth_casattras_port_key', 'auth_casattras'),
new lang_string('auth_casattras_port', 'auth_casattras'), '', PARAM_INT));
// CAS Version.
$casversions = array();
$casversions['CAS_VERSION_1_0'] = 'CAS 1.0';
$casversions['CAS_VERSION_2_0'] = 'CAS 2.0';
$casversions['CAS_VERSION_3_0'] = 'CAS 3.0';
$casversions['SAML_VERSION_1_1'] = 'SAML 1.1';
$settings->add(new admin_setting_configselect('auth_casattras/casversion',
new lang_string('auth_casattras_casversion', 'auth_casattras'),
new lang_string('auth_casattras_version', 'auth_casattras'), 'CAS_VERSION_3_0', $casversions));
// Proxy.
$yesno = array(
new lang_string('no'),
new lang_string('yes'),
);
$settings->add(new admin_setting_configselect('auth_casattras/proxycas',
new lang_string('auth_casattras_proxycas_key', 'auth_casattras'),
new lang_string('auth_casattras_proxycas', 'auth_casattras'), 0 , $yesno));
// Logout option.
$settings->add(new admin_setting_configselect('auth_casattras/logoutcas',
new lang_string('auth_casattras_logoutcas_key', 'auth_casattras'),
new lang_string('auth_casattras_logoutcas', 'auth_casattras'), 0 , $yesno));
// Multi-auth.
$settings->add(new admin_setting_configselect('auth_casattras/multiauth',
new lang_string('auth_casattras_multiauth_key', 'auth_casattras'),
new lang_string('auth_casattras_multiauth', 'auth_casattras'), 0 , $yesno));
// Server validation.
$settings->add(new admin_setting_configselect('auth_casattras/certificatecheck',
new lang_string('auth_casattras_certificate_check_key', 'auth_casattras'),
new lang_string('auth_casattras_certificate_check', 'auth_casattras'), 0 , $yesno));
// Certificate path.
$settings->add(new admin_setting_configfile('auth_casattras/certificatepath',
new lang_string('auth_casattras_certificate_path_key', 'auth_casattras'),
new lang_string('auth_casattras_certificate_path', 'auth_casattras'), ''));
// Alt Logout URL.
$settings->add(new admin_setting_configtext('auth_casattras/logoutreturnurl',
new lang_string('auth_casattras_logout_return_url_key', 'auth_casattras'),
new lang_string('auth_casattras_logout_return_url', 'auth_casattras'), '', PARAM_URL));
// Display locking / mapping of profile fields.
$authplugin = get_auth_plugin('casattras');
display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields, '', true, true,
$authplugin->get_custom_user_profile_fields());
}