forked from nilsteampassnet/TeamPass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
roles.php
100 lines (89 loc) · 3.76 KB
/
roles.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
<?php
/**
* @file roles.php
* @author Nils Laumaillé
* @version 2.1
* @copyright (c) 2009-2011 Nils Laumaillé
* @licensing GNU AFFERO GPL 3.0
* @link http://www.teampass.net
*
* This library 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.
*/
if (!isset($_SESSION['CPM'] ) || $_SESSION['CPM'] != 1)
die('Hacking attempt...');
//load help
require_once('includes/language/'.$_SESSION['user_language'].'_admin_help.php');
//Get full list of groups
$arr_groups = array();
$rows = $db->fetch_all_array("SELECT id,title FROM ".$pre."nested_tree");
foreach( $rows as $reccord )
$arr_groups[$reccord['id']] = $reccord['title'];
//display
echo '
<div class="title ui-widget-content ui-corner-all">
'.$txt['admin_functions'].'
<img src="includes/images/users--plus.png" title="'.$txt['add_role_tip'].'" onclick="OpenDialog(\'add_new_role\')" style="cursor:pointer;" />
<a onClick="refresh_roles_matrix()"><img src="includes/images/arrow_refresh.png" style="cursor:pointer" title="'.$txt['refresh_matrix'].'" /></a>
<span style="float:right;margin-right:5px;"><img src="includes/images/question-white.png" style="cursor:pointer" title="'.$txt['show_help'].'" onclick="OpenDialog(\'help_on_roles\')" /></span>
</div>
<div style="line-height:20px;" align="center">
<div id="matrice_droits"></div>
<div style="">
<img src="includes/images/arrow-180.png" style="display:none; cursor:pointer" id="roles_previous" onclick="refresh_roles_matrix(\'previous\')">
<img src="includes/images/arrow-0.png" style="display:none;cursor:pointer" id="roles_next" onclick="refresh_roles_matrix(\'next\')">
</div>
</div>
<input type="hidden" id="selected_function" />
<input type="hidden" id="next_role" value="0" />
<input type="hidden" id="previous_role" value="0" />
<input type="hidden" id="role_start" value="0" />';
// DIV FOR ADDING A ROLE
echo '
<div id="add_new_role" style="">
<p>
<label for="new_function" class="form_label_100">'.$txt['name'].'</label><input type="text" id="new_function" size="40" />
</p>
<p>
<label for="new_role_complexity" class="form_label">'.$txt['complex_asked'].' :</label>
<select id="new_role_complexity" class="input_text text ui-widget-content ui-corner-all">
<option value="">---</option>';
foreach($pw_complexity as $complex)
echo '<option value="'.$complex[0].'">'.$complex[1].'</option>';
echo '
</select>
</p>
</div>';
// DIV FOR DELETING A ROLE
echo '
<div id="delete_role" style="display:none;">
<div>'.$txt['confirm_del_role'].'</div>
<div style="font-weight:bold;text-align:center;color:#FF8000;text-align:center;font-size:13pt;" id="delete_role_show"></div>
<input type="hidden" id="delete_role_id" />
</div>';
// DIV FOR EDITING A ROLE
echo '
<div id="edit_role" style="display:none;">
<div>'.$txt['confirm_edit_role'].'</div>
<div style="font-weight:bold;text-align:center;color:#FF8000;text-align:center;font-size:13pt;" id="edit_role_show"></div>
<input type="hidden" id="edit_role_id" />
<label for="edit_role_title" class="form_label">'.$txt['new_role_title'].'</label><input type="text" id="edit_role_title" size="40" />
<p>
<label for="edit_role_complexity" class="form_label">'.$txt['complex_asked'].' :</label>
<select id="edit_role_complexity" class="input_text text ui-widget-content ui-corner-all">
<option value="">---</option>';
foreach($pw_complexity as $complex)
echo '<option value="'.$complex[0].'">'.$complex[1].'</option>';
echo '
</select>
</p>
</div>';
// DIV FOR HELP
echo '
<div id="help_on_roles">
<div>'.$txt['help_on_roles'].'</div>
</div>';
//call to roles.load.php
require_once("roles.load.php");
?>