File: users.lua

package info (click to toggle)
ntopng 5.2.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 121,832 kB
  • sloc: javascript: 143,431; cpp: 71,175; ansic: 11,108; sh: 4,687; makefile: 911; python: 587; sql: 512; pascal: 234; perl: 118; ruby: 52; exp: 4
file content (76 lines) | stat: -rw-r--r-- 1,781 bytes parent folder | download
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
local page_utils = require("page_utils")
local get_users_url = ntop.getHttpPrefix().."/lua/admin/get_users.lua"
local users_type = {ntopng=ternary(ntop.isnEdge(), i18n("nedge.system_users"), i18n("login.web_users"))}

local title = users_type["ntopng"]

page_utils.print_page_title(title)


print [[
    <div id="table-users"></div>
	 <script>
	 $("#table-users").datatable({
		url: "]]
print (get_users_url)
print [[",
		showPagination: true,
		title: "",
		buttons: [
			"<a href='#add_user_dialog' role='button' class='add-on btn' data-bs-toggle='modal'><i class='fas fa-plus fa-sm'></i></a>"
		],
		tableCallback: function() {

			// if there is `user` get param then open the user's modal
			let user = "]] print(_GET["user"]) print [[";
			if (user !== "nil" && isAdministrator) {

				reset_pwd_dialog(user);
				// set the preference tab
				$(`#change-password-dialog`).removeClass('active');
				$(`a[href='#change-password-dialog']`).removeClass('active');
				$(`#li_change_prefs > a`).addClass('active');
				$(`#change-prefs-dialog`).tab('show');
				// show the modal
				$(`#password_dialog`).modal('show');
			}

		},
		columns: [
			{
				title: "]] print(i18n("login.username")) print[[",
				field: "column_username",
				sortable: true,
				css: {
					textAlign: 'left'
				}
			},
			{
				title: "]] print(i18n("users.full_name")) print[[",
				field: "column_full_name",
				sortable: true,
				css: {
					textAlign: 'left'
				}

			},
			{
				title: "]] print(i18n("manage_users.group")) print[[",
				field: "column_group",
				sortable: true,
				css: {
					textAlign: 'center'
				}
			},
			{
				title: "]] print(i18n("users.edit")) print[[",
				field: "column_edit",
				css: {
					textAlign: 'center'
				}
			},
		]
	 });
	 </script>

   ]]