Project

General

Profile

Download (6.37 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	system_usermanager_settings.php
5

    
6
	part of pfSense (https://www.pfsense.org/)
7

    
8
	Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com>
9
	Copyright (C) 2007 Bill Marquette <bill.marquette@gmail.com>
10
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
11
	All rights reserved.
12

    
13
	Redistribution and use in source and binary forms, with or without
14
	modification, are permitted provided that the following conditions are met:
15

    
16
	1. Redistributions of source code must retain the above copyright notice,
17
	   this list of conditions and the following disclaimer.
18

    
19
	2. Redistributions in binary form must reproduce the above copyright
20
	   notice, this list of conditions and the following disclaimer in the
21
	   documentation and/or other materials provided with the distribution.
22

    
23
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
27
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
	POSSIBILITY OF SUCH DAMAGE.
33
*/
34
/*
35
	pfSense_MODULE:	auth
36
*/
37

    
38
##|+PRIV
39
##|*IDENT=page-system-usermanager-settings
40
##|*NAME=System: User Manager: settings page
41
##|*DESCR=Allow access to the 'System: User Manager: settings' page.
42
##|*MATCH=system_usermanager_settings.php*
43
##|-PRIV
44

    
45
require("guiconfig.inc");
46

    
47
$pconfig['session_timeout'] = &$config['system']['webgui']['session_timeout'];
48
$pconfig['authmode'] = &$config['system']['webgui']['authmode'];
49
$pconfig['backend'] = &$config['system']['webgui']['backend'];
50

    
51
// Page title for main admin
52
$pgtitle = array(gettext("System"),gettext("User manager settings"));
53

    
54
$save_and_test = false;
55
if ($_POST) {
56
	unset($input_errors);
57
	$pconfig = $_POST;
58

    
59
	if(isset($_POST['session_timeout'])) {
60
		$timeout = intval($_POST['session_timeout']);
61
		if ($timeout != "" && (!is_numeric($timeout) || $timeout <= 0))
62
			$input_errors[] = gettext("Session timeout must be an integer value.");
63
	}
64

    
65
	if (!$input_errors) {
66
		if ($_POST['authmode'] != "local") {
67
			$authsrv = auth_get_authserver($_POST['authmode']);
68
			if ($_POST['savetest'])
69
				if ($authsrv['type'] == "ldap")
70
					$save_and_test = true;
71
				else
72
					$savemsg = gettext("The test was not performed because it is supported only for ldap based backends.");
73
		}
74

    
75

    
76
		if(isset($_POST['session_timeout']) && $_POST['session_timeout'] != "")
77
			$config['system']['webgui']['session_timeout'] = intval($_POST['session_timeout']);
78
		else
79
			unset($config['system']['webgui']['session_timeout']);
80

    
81
		if($_POST['authmode'])
82
			$config['system']['webgui']['authmode'] = $_POST['authmode'];
83
		else
84
			unset($config['system']['webgui']['authmode']);
85

    
86
		write_config();
87

    
88
	}
89
}
90

    
91
include("head.inc");
92
?>
93

    
94
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
95
<?php include("fbegin.inc");?>
96
<?php if ($input_errors) print_input_errors($input_errors);?>
97
<?php if ($savemsg) print_info_box($savemsg);?>
98

    
99
<?php
100
	if($save_and_test) {
101
		echo "<script type=\"text/javascript\">\n";
102
		echo "//<![CDATA[\n";
103
		echo "myRef = window.open('system_usermanager_settings_test.php?authserver={$pconfig['authmode']}','mywin', ";
104
		echo "'left=20,top=20,width=700,height=550,toolbar=1,resizable=0');\n";
105
		echo "if (myRef==null || typeof(myRef)=='undefined') alert('" . gettext("Popup blocker detected.  Action aborted.") ."');\n";
106
		echo "//]]>\n";
107
		echo "</script>\n";
108
	}
109
?>
110

    
111
	<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="user manager settings">
112
		<tr>
113
			<td class="tabnavtbl">
114
<?php
115
				$tab_array = array();
116
				$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
117
				$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
118
				$tab_array[] = array(gettext("Settings"), true, "system_usermanager_settings.php");
119
				$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
120
				display_top_tabs($tab_array);
121

    
122
				/* Default to pfsense backend type if none is defined */
123
				if(!$pconfig['backend'])
124
					$pconfig['backend'] = "pfsense";
125
?>
126
			</td>
127
		</tr>
128
		<tr>
129
			<td>
130
				<div id="mainarea">
131
					<form id="iform" name="iform" action="system_usermanager_settings.php" method="post">
132
						<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6" summary="main area">
133
							<tr>
134
								<td width="22%" valign="top" class="vncell"><?=gettext("Session Timeout"); ?></td>
135
								<td width="78%" class="vtable">
136
									<input name="session_timeout" id="session_timeout" type="text" size="8" value="<?=htmlspecialchars($pconfig['session_timeout']);?>" />
137
									<br />
138
									<?=gettext("Time in minutes to expire idle management sessions. The default is 4 hours (240 minutes).");?><br />
139
									<?=gettext("Enter 0 to never expire sessions. NOTE: This is a security risk!");?><br />
140
								</td>
141
							</tr>
142
							<tr>
143
								<td width="22%" valign="top" class="vncell"><?=gettext("Authentication Server"); ?></td>
144
								<td width="78%" class="vtable">
145
									<select name='authmode' id='authmode' class="formselect" >
146
<?php
147
									$auth_servers = auth_get_authserver_list();
148
									foreach ($auth_servers as $auth_server):
149
										$selected = "";
150
										if ($auth_server['name'] == $pconfig['authmode'])
151
											$selected = "selected=\"selected\"";
152
										if (!isset($pconfig['authmode']) && $auth_server['name'] == "Local Database")
153
											$selected = "selected=\"selected\"";
154
?>
155
										<option value="<?=$auth_server['name'];?>" <?=$selected;?>><?=$auth_server['name'];?></option>
156
<?php
157
									endforeach;
158
?>
159
									</select>
160
								</td>
161
							</tr>
162
							<tr>
163
								<td width="22%" valign="top">&nbsp;</td>
164
								<td width="78%">
165
									<input id="save" name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
166
									<input id="savetest" name="savetest" type="submit" class="formbtn" value="<?=gettext("Save and Test");?>" />
167
								</td>
168
							</tr>
169
						</table>
170
					</form>
171
				</div>
172
			</td>
173
		</tr>
174
	</table>
175
<?php include("fend.inc");?>
176
</body>
177
</html>
(232-232/256)