Subversion Repositories ALCASAR

Rev

Rev 2382 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2382 Rev 2654
Line 2... Line 2...
2
//gestion de la langue
2
//gestion de la langue
3
if (is_file("../lib/langues.php"))
3
if (is_file("../lib/langues.php"))
4
	include("../lib/langues.php");
4
	include("../lib/langues.php");
5
require('/etc/freeradius-web/config.php');
5
require('/etc/freeradius-web/config.php');
6
if (!isset($type)) $type = 'user';
6
if (!isset($type)) $type = 'user';
-
 
7
if (!isset($user_type)) $user_type = 'user';
-
 
8
if (!isset($delete_user)) $delete_user = 0;
7
if ($type != 'group'){
9
if ($user_type != 'group'){
8
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
10
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
9
		include("../lib/$config[general_lib_type]/user_info.php");
11
		include("../lib/$config[general_lib_type]/user_info.php");
10
}
12
}
11
else {
13
else {
12
	if (is_file("../lib/$config[general_lib_type]/group_info.php"))
14
	if (is_file("../lib/$config[general_lib_type]/group_info.php"))
Line 18... Line 20...
18
echo <<<EOM
20
echo <<<EOM
19
<html>
21
<html>
20
<head>
22
<head>
21
EOM;
23
EOM;
22
 
24
 
23
if (!isset($user_type)) $user_type = 'user';
-
 
24
if (!isset($delete_user)) $delete_user = 0;
-
 
25
 
-
 
26
if ($user_type != 'group'){
25
if ($user_type != 'group') {
27
	$util = $l_user;
26
	$util = $l_user;
28
	$title = $l_users_managment;}
27
	$title = $l_users_managment;
-
 
28
	$cnName = " ($cn)";
-
 
29
}
29
else{
30
else {
30
	$util = $l_group;
31
	$util = $l_group;
31
	$title = $l_groups_managment;}
32
	$title = $l_groups_managment;
-
 
33
	$cnName = '';
-
 
34
}
32
 
35
 
33
echo <<<EOM
36
echo <<<EOM
34
<title>delete users and groups</title>
37
<title>delete users and groups</title>
35
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
38
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
36
<link rel="stylesheet" href="/css/style.css">
39
<link rel="stylesheet" href="/css/style.css">
Line 64... Line 67...
64
<tr valign=top>
67
<tr valign=top>
65
<td width=400></td>
68
<td width=400></td>
66
<td bgcolor="black">
69
<td bgcolor="black">
67
	<table border=0 width=100% cellpadding=2 cellspacing=0>
70
	<table border=0 width=100% cellpadding=2 cellspacing=0>
68
	<tr bgcolor="#907030" align=right valign=top><th>
71
	<tr bgcolor="#907030" align=right valign=top><th>
69
	<font color="white">$util : $login ($cn)</font>&nbsp;
72
	<font color="white">$util : $login$cnName</font>&nbsp;
70
	</th></tr>
73
	</th></tr>
71
	</table>
74
	</table>
72
</td></tr>
75
</td></tr>
73
<tr bgcolor="black" valign=top><td colspan=2>
76
<tr bgcolor="black" valign=top><td colspan=2>
74
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
77
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
75
	<tr><td>
78
	<tr><td>
76
EOM;
79
EOM;
77
 
80
 
78
if ($delete_user == 1){
81
if ($delete_user == 1){
79
	if ($user_type != 'group'){
82
	if ($user_type != 'group'){
-
 
83
		// Disconnecting user
-
 
84
		$mac = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$login.'") {print $1}'));
-
 
85
		if (!empty($mac)) {
-
 
86
			exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($mac));
-
 
87
		}
-
 
88
 
80
		if (is_file("../lib/$config[general_lib_type]/delete_user.php"))
89
		if (is_file("../lib/$config[general_lib_type]/delete_user.php"))
81
			include("../lib/$config[general_lib_type]/delete_user.php");
90
			include("../lib/$config[general_lib_type]/delete_user.php");
82
	}
91
	}
83
	else{
92
	else{
-
 
93
		$group_macs = [];
-
 
94
		// Disconnecting users
-
 
95
		foreach ($group_members as $member){
-
 
96
			$mac = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$member.'") {print $1}'));
-
 
97
			if (!empty($mac)) {
-
 
98
				exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($mac));
-
 
99
				if ($member === $mac) {
-
 
100
					$group_macs[] = $mac;
-
 
101
				}
-
 
102
			}
-
 
103
		}
84
		if (isset($delete_users_of_group) && $delete_users_of_group == 1){
104
		if (isset($delete_users_of_group) && $delete_users_of_group == 1){
85
			unset($group_members);
-
 
86
			$tmp_group_name=$login;
105
			$tmp_group_name=$login;
87
			if (is_file("../lib/$config[general_lib_type]/group_info.php")){
-
 
88
				include("../lib/$config[general_lib_type]/group_info.php");
-
 
89
			}
-
 
90
			foreach ($group_members as $member){
106
			foreach ($group_members as $member){
91
				$login=$member;
107
				$login=$member;
92
				if (is_file("../lib/$config[general_lib_type]/delete_user.php"))
108
				if (is_file("../lib/$config[general_lib_type]/delete_user.php"))
93
					include("../lib/$config[general_lib_type]/delete_user.php");
109
					include("../lib/$config[general_lib_type]/delete_user.php");
94
			}
110
			}
95
			$login=$tmp_group_name;
111
			$login=$tmp_group_name;
-
 
112
		} else {
-
 
113
			// Reconnect allowed MAC from the selected group
-
 
114
			foreach ($group_macs as $mac) {
-
 
115
				exec('sudo /usr/sbin/chilli_query login mac '.escapeshellarg($mac).' username '.escapeshellarg($mac)." password 'password'");
-
 
116
			}
96
		}
117
		}
97
		if (is_file("../lib/$config[general_lib_type]/delete_group.php"))
118
		if (is_file("../lib/$config[general_lib_type]/delete_group.php"))
98
			include("../lib/$config[general_lib_type]/delete_group.php");
119
			include("../lib/$config[general_lib_type]/delete_group.php");
99
	}
120
	}
100
	echo <<<EOM
121
	echo <<<EOM