summaryrefslogtreecommitdiffstats
path: root/base/tps/shared/webapps/tps/ui/index.html
blob: 8c6092098b7e3e9c7f4225c8079a41913060da10 (plain)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
<!-- --- BEGIN COPYRIGHT BLOCK ---
     This program 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; version 2 of the License.

     This program 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 this program; if not, write to the Free Software Foundation, Inc.,
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

     Copyright (C) 2013 Red Hat, Inc.
     All rights reserved.
     --- END COPYRIGHT BLOCK --- -->
<html>
<head>
    <title>Token Processing System</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="/pki/css/patternfly.css" rel="stylesheet" media="screen, print">
    <link href="/pki/css/pki-ui.css" rel="stylesheet" type="text/css">
    <script src="/pki/js/jquery.js"></script>
    <script src="/pki/js/underscore.js"></script>
    <script src="/pki/js/backbone.js"></script>
    <script src="/pki/js/bootstrap.js"></script>
    <script src="/pki/js/patternfly.js"></script>
    <script src="/pki/js/pki-ui.js"></script>
    <script src="/tps/js/tps.js"></script>
    <script src="/tps/js/account.js"></script>
    <script src="/tps/js/activity.js"></script>
    <script src="/tps/js/audit.js"></script>
    <script src="/tps/js/authenticator.js"></script>
    <script src="/tps/js/cert.js"></script>
    <script src="/tps/js/config.js"></script>
    <script src="/tps/js/connector.js"></script>
    <script src="/tps/js/group.js"></script>
    <script src="/tps/js/profile.js"></script>
    <script src="/tps/js/profile-mapping.js"></script>
    <script src="/tps/js/selftest.js"></script>
    <script src="/tps/js/token.js"></script>
    <script src="/tps/js/user.js"></script>
    <script>
$(function() {

    var account = new Account();
    account.login({
        success: function(data, textStatus, jqXHR) {
            tps.user = data;
            var roles = tps.user.Roles.Role;

            var user = $("#navigation [name=account] [name=username]");
            user.text(data.FullName);

            var accounts_menu = $("#navigation [name=accounts]");
            var system_menu = $("#navigation [name=system]");

            if (_.contains(roles, "Administrators")) {
                accounts_menu.show();
            } else {
                accounts_menu.hide();
            }

            if (_.contains(roles, "Administrators")) {
                system_menu.show();
                $("li", system_menu).show();

            } else if (_.contains(roles, "TPS Agents")) {
                system_menu.show();
                $("li", system_menu).hide();
                $("[name=profiles]", system_menu).show();

            } else {
                system_menu.hide();
            }

            homePage.update();
        },
        error: function(jqXHR, textStatus, errorThrown) {
            window.location.href = "/tps";
        }
    });

    var content = $("#content");

    var router = new Backbone.Router();

    var homePage = new HomePage({
        el: content,
        url: "home.html"
    });

    router.route("", "home", function() {
        homePage.open();
    });

    router.route("activities", "activities", function() {
        new ActivitiesPage({
            el: content,
            url: "activities.html"
        }).open();
    });

    router.route("activities/:id", "activity", function(id) {
        new ActivityPage({
            el: content,
            url: "activity.html",
            model: new ActivityModel({ id: id })
        }).open();
    });

    router.route("audit", "audit", function() {
        new AuditPage({
            el: content,
            url: "audit.html"
        }).open();
    });

    router.route("authenticators", "authenticators", function() {
        new AuthenticatorsPage({
            el: content,
            url: "authenticators.html"
        }).open();
    });

    router.route("authenticators/:id", "authenticator", function(id) {
        new ConfigEntryPage({
            el: content,
            url: "authenticator.html",
            model: new AuthenticatorModel({ id: id })
        }).open();
    });

    router.route("new-authenticator", "new-authenticator", function() {
        new ConfigEntryPage({
            el: content,
            url: "authenticator.html",
            model: new AuthenticatorModel(),
            mode: "add",
            title: "New Authenticator",
            editable: ["authenticatorID"],
            parentHash: "#authenticators"
        }).open();
    });

    router.route("certs", "certs", function() {
        new CertificatesPage({
            el: content,
            url: "certs.html",
            collection: new CertificateCollection()
        }).open();
    });

    router.route("certs/:id", "cert", function(id) {
        new CertificatePage({
            el: content,
            url: "cert.html",
            model: new CertificateModel({ id: id })
        }).open();
    });

    router.route("config", "config", function() {
        new ConfigPage({
            el: content,
            url: "config.html"
        }).open();
    });

    router.route("connectors", "connectors", function() {
        new ConnectorsPage({
            el: content,
            url: "connectors.html"
        }).open();
    });

    router.route("connectors/:id", "connector", function(id) {
        new ConfigEntryPage({
            el: content,
            url: "connector.html",
            model: new ConnectorModel({ id: id })
        }).open();
    });

    router.route("new-connector", "new-connector", function() {
        new ConfigEntryPage({
            el: content,
            url: "connector.html",
            model: new ConnectorModel(),
            mode: "add",
            title: "New Connector",
            editable: ["connectorID"],
            parentHash: "#connectors"
        }).open();
    });

    router.route("groups", "groups", function() {
        new GroupsPage({
            el: content,
            url: "groups.html"
        }).open();
    });

    router.route("groups/:id", "group", function(id) {
        new GroupPage({
            el: content,
            url: "group.html",
            model: new GroupModel({ id: id }),
            editable: ["description"]
        }).open();
    });

    router.route("new-group", "new-group", function() {
        new GroupPage({
            el: content,
            url: "group.html",
            model: new GroupModel(),
            mode: "add",
            title: "New Group",
            editable: ["groupID", "description"],
            parentHash: "#groups"
        }).open();
    });

    router.route("profiles", "profiles", function() {
        new ProfilesPage({
            el: content,
            url: "profiles.html"
        }).open();
    });

    router.route("profiles/:id", "profile", function(id) {
        new ProfilePage({
            el: content,
            url: "profile.html",
            model: new ProfileModel({ id: id })
        }).open();
    });

    router.route("new-profile", "new-profile", function() {
        new ProfilePage({
            el: content,
            url: "profile.html",
            model: new ProfileModel(),
            mode: "add",
            title: "New Profile",
            editable: ["profileID"],
            parentHash: "#profiles"
        }).open();
    });

    router.route("profile-mappings", "profile-mappings", function() {
        new ProfileMappingsPage({
            el: content,
            url: "profile-mappings.html"
        }).open();
    });

    router.route("profile-mappings/:id", "profile-mapping", function(id) {
        new ConfigEntryPage({
            el: content,
            url: "profile-mapping.html",
            model: new ProfileMappingModel({ id: id }),
        }).open();
    });

    router.route("new-profile-mapping", "new-profile-mapping", function() {
        new ConfigEntryPage({
            el: content,
            url: "profile-mapping.html",
            model: new ProfileMappingModel(),
            mode: "add",
            title: "New Profile Mapping",
            editable: ["profileMappingID"],
            parentHash: "#profile-mappings"
        }).open();
    });

    router.route("selftests", "selftests", function() {
        new SelfTestsPage({
            el: content,
            url: "selftests.html"
        }).open();
    });

    router.route("selftests/:id", "selftest", function(id) {
        new SelfTestPage({
            el: content,
            url: "selftest.html",
            model: new SelfTestModel({ id: id })
        }).open();
    });

    router.route("tokens", "tokens", function() {
        new TokensPage({
            el: content,
            url: "tokens.html"
        }).open();
    });

    router.route("tokens/:id", "token", function(id) {
        new TokenPage({
            el: content,
            url: "token.html",
            model: new TokenModel({ id: id }),
            editable: ["userID", "policy"]
        }).open();
    });

    router.route("tokens/:id/certs", "certs", function(id) {
        new CertificatesPage({
            el: content,
            url: "certs.html",
            collection: new CertificateCollection({ tokenID: id })
        }).open();
    });

    router.route("new-token", "new-token", function() {
        new TokenPage({
            el: content,
            url: "token.html",
            model: new TokenModel(),
            mode: "add",
            title: "New Token",
            editable: ["tokenID", "userID", "type", "appletID", "keyInfo", "policy"],
            parentHash: "#tokens"
        }).open();
    });

    router.route("users", "users", function() {
        new UsersPage({
            el: content,
            url: "users.html"
        }).open();
    });

    router.route("users/:id", "user", function(id) {
        new UserPage({
            el: content,
            url: "user.html",
            model: new UserModel({ id: id }),
            editable: ["fullName", "email", "tpsProfiles"]
        }).open();
    });

    router.route("new-user", "new-user", function() {
        new UserPage({
            el: content,
            url: "user.html",
            model: new UserModel(),
            mode: "add",
            title: "New User",
            editable: ["userID", "fullName", "email", "tpsProfiles"],
            parentHash: "#users"
        }).open();
    });

    router.route("logout", "logout", function() {
        // destroy server session
        account.logout({
            success: function() {
                tps.user = null;
                // clear browser cache
                PKI.logout({
                    success: function() {
                        window.location.href = "/tps";
                    },
                    error: function() {
                        alert("Logout not supported by the browser. Please clear Active Logins or close the browser.");
                    }
                });
            },
            error: function() {
                alert("Logout failed. Please close the browser.");
            }
        });
    });

    Backbone.history.start();
});
    </script>
</head>
<body>

<nav id="navigation" class="navbar navbar-default navbar-pf" role="navigation">
<div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand" href="/tps">
        <b>Token Processing Service</b>
    </a>
</div>
<div class="collapse navbar-collapse navbar-collapse-1">
    <ul class="nav navbar-nav navbar-utility">
    <li name="status"><a href="#">Status</a></li>
    <li name="account" class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
        <span class="pficon pficon-user"></span>
        <span name="username"></span><b class="caret"></b>
        </a>
        <ul class="dropdown-menu">
        <li name="logout"><a href="#logout">Logout</a></li>
        </ul>
    </li>
    </ul>
    <ul class="nav navbar-nav navbar-primary">
    <li name="home"><a href="#"><span class="glyphicon glyphicon-home"></span> Home</a></li>
    <li name="tokens"><a href="#tokens">Tokens</a></li>
    <li name="certs"><a href="#certs">Certificates</a></li>
    <li name="activities"><a href="#activities">Activities</a></li>
    <li name="accounts" class="dropdown context" style="display: none;">
      <a href="#" class="dropdown-toggle" data-toggle="dropdown">
        Accounts
        <b class="caret"></b>
      </a>
      <ul class="dropdown-menu">
        <li><a href="#users">Users</a></li>
        <li><a href="#groups">Groups</a></li>
      </ul>
    </li>
    <li name="system" class="dropdown context">
      <a href="#" class="dropdown-toggle" data-toggle="dropdown">
        System
        <b class="caret"></b>
      </a>
      <ul class="dropdown-menu">
        <li name="config" style="display: none;"><a href="#config">General Configuration</a></li>
        <li name="authenticators" style="display: none;"><a href="#authenticators">Authentication Sources</a></li>
        <li name="connectors" style="display: none;"><a href="#connectors">Subsystem Connections</a></li>
        <li name="profiles" style="display: none;"><a href="#profiles">Profiles</a></li>
        <li name="profile-mappings" style="display: none;"><a href="#profile-mappings">Profile Mappings</a></li>
        <li name="audit" style="display: none;"><a href="#audit">Audit Logging</a></li>
        <li name="selftests" style="display: none;"><a href="#selftests">Self Tests</a></li>
      </ul>
    </li>
    </ul>
</div>
</nav>

<div id="content">
</div>

<div id="confirm-dialog" class="modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    <span class="pficon pficon-close"></span>
                </button>
                <h4 class="modal-title">Confirmation</h4>
            </div>
            <div class="modal-body">
            </div>
            <div class="modal-footer">
                <button name="ok" class="btn btn-danger">OK</button>
                <button name="cancel" class="btn btn-default" data-dismiss="modal">Cancel</button>
            </div>
        </div>
    </div>
</div>

<div id="error-dialog" class="modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    <span class="pficon pficon-close"></span>
                </button>
                <h4 class="modal-title">Error</h4>
            </div>
            <div class="modal-body">
		        <fieldset>
		            <span name="content"></span>
		        </fieldset>
            </div>
            <div class="modal-footer">
                <button name="close" class="btn btn-primary">Close</button>
            </div>
        </div>
    </div>
</div>

</body>
</html>