-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrbac.html
736 lines (657 loc) · 25.2 KB
/
rbac.html
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
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
<!DOCTYPE html>
<html>
<head>
<title>RBAC HTML Table</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<div>
<h1>Task #1</h1>
<div class="activity">
<p><strong>Task Description:</strong> In this task, you will be presented with a real-world scenario and asked to
implement a proper permission policy. You will need to identify the correct entity, permission (ALLOW/DENY), and
targeted resources to effectively address the situation. </p>
<div class="scenario">
<h2>Scenario:</h2>
<p>A new employee has joined the company and requires access to employee information. You need to create a
permission
policy that allows the employee to view employee information.</p>
</div>
<div class="question">
<h2>Question:</h2>
<p>What entity, permission, and targeted resources do you need to include in the permission policy to address
this situation?</p>
<form>
<label for="entity">Entity:</label>
<select id="entity">
<option value="">Select entity</option>
<option value="employee">Employee</option>
<option value="HR">HR</option>
<option value="manager">Manager</option>
</select>
<label for="permission">Permission:</label>
<select id="permission">
<option value="">Select permission</option>
<option value="allow">Allow</option>
<option value="deny">Deny</option>
</select>
<label for="resources">Targeted resources:</label>
<select id="resources">
<option value="">Select resources</option>
<option value="employee-info">Employee information</option>
<option value="salary">Salary information</option>
<option value="performance-review">Performance review information</option>
</select>
<button id="submit-btn" type="button">Submit</button>
</form>
</div>
<div class="feedback">
<h2>Feedback:</h2>
<p class="result"></p>
</div>
</div>
<script>
$(document).ready(function () {
$('#submit-btn').click(function (event) {
event.preventDefault();
var entity = $('#entity').val();
var permission = $('#permission').val();
var resources = $('#resources').val();
if (entity && permission && resources) {
if (entity === 'employee' && permission === 'allow' && resources === 'employee-info') {
$('.result').text('Correct! The employee should be allowed to view employee information.').addClass('correct').removeClass('incorrect');
} else {
$('.result').text('Incorrect. Please try again.').addClass('incorrect').removeClass('correct');
}
} else {
$('.result').text('Please select all options.').addClass('incorrect').removeClass('correct');
}
});
});
</script>
</div>
<div>
<h1>Task #2</h1>
<div class="activity">
<p><strong>Task Description:</strong> In this task, you will be presented with a real-world scenario and asked to
implement a proper permission policy. You will need to identify the correct entity, permission (ALLOW/DENY), and
targeted resources to effectively address the situation. </p>
<div class="scenario">
<h2>Scenario:</h2>
<p>A new employee has joined the company. As the employee has no HR responsibilities nor is a Manager, you want
to ensure that the employee cannot accidentally access the confidential salary information. You need to create
a permission policy that denies the employee access to salary information.
</p>
</div>
<div class="question">
<h2>Question:</h2>
<p>What entity, permission, and targeted resources do you need to include in the permission policy to address
this
situation?</p>
<form>
<label for="entity2">Entity:</label>
<select id="entity2">
<option value="">Select entity</option>
<option value="employee">Employee</option>
<option value="HR">HR</option>
<option value="manager">Manager</option>
</select>
<label for="permission2">Permission:</label>
<select id="permission2">
<option value="">Select permission</option>
<option value="allow">Allow</option>
<option value="deny">Deny</option>
</select>
<label for="resources2">Targeted resources:</label>
<select id="resources2">
<option value="">Select resources</option>
<option value="employee-info">Employee information</option>
<option value="salary">Salary information</option>
<option value="performance-review">Performance review information</option>
</select>
<button id="submit-btn2" type="button">Submit</button>
</form>
</div>
<div class="feedback">
<h2>Feedback:</h2>
<p class="result2"></p>
</div>
</div>
<script>
$(document).ready(function () {
$('#submit-btn2').click(function (event) {
event.preventDefault();
var entity = $('#entity2').val();
var permission = $('#permission2').val();
var resources = $('#resources2').val();
if (entity && permission && resources) {
if (entity === 'employee' && permission === 'deny' && resources === 'salary') {
$('.result2').text('Correct! The employee should be denied access to salary information.').addClass('correct').removeClass('incorrect');
} else {
$('.result2').text('Incorrect. Please try again.').addClass('incorrect').removeClass('correct');
}
} else {
$('.result2').text('Please select all options.').addClass('incorrect').removeClass('correct');
}
});
});
</script>
</div>
<div>
<h1>Task #3-1</h1>
<p><strong>Task Description:</strong> In this task, you are provided with:</p>
<ul>
<li>A membership policy table</li>
<li>An interactive table named "Membership Evaluation"</li>
</ul>
<p>The "Membership Evaluation" table contains a sequence of questions. You need to answer the questions by
selecting the correct option from the drop-down menu. The table will then display whether your answer is correct
or not.
</p>
<h2>Membership Policy Table</h2>
<table>
<thead>
<tr>
<th>Member</th>
<th>Group</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>User A</td>
<td>Group A</td>
<td>User A is a member of Group A</td>
</tr>
<tr>
<td>Group A</td>
<td>Group B</td>
<td>Group A is a member of Group B</td>
</tr>
</tbody>
</table>
<h2>Membership Evaluation</h2>
<table>
<thead>
<tr>
<th>User</th>
<th>Is User A a member of Group A?</th>
<th>Is User A a member of Group B?</th>
<th>Is User A a member of Group C?</th>
</tr>
</thead>
<tbody>
<tr>
<td>User A</td>
<td>
<select id="user-a-group-a">
<option value="">Select option</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</td>
<td>
<select id="user-a-group-b">
<option value="">Select option</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</td>
<td>
<select id="user-a-group-c">
<option value="">Select option</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</td>
</tr>
</tbody>
</table>
<div class="feedback">
<h2>Feedback:</h2>
<ul>
<li class="user-a-group-a"></li>
<li class="user-a-group-b"></li>
<li class="user-a-group-c"></li>
</ul>
</div>
<script>
$(document).ready(function () {
$('#user-a-group-a').change(function () {
evaluateMembershipA();
});
$('#user-a-group-b').change(function () {
evaluateMembershipB();
});
$('#user-a-group-c').change(function () {
evaluateMembershipC();
});
function evaluateMembershipA() {
var userAGroupA = $('#user-a-group-a').val();
if (userAGroupA) {
if (userAGroupA === 'yes') {
$('.user-a-group-a').text('Correct - User A is a member of Group A, as shown in the membership policy table.').addClass('correct').removeClass('incorrect');
} else {
$('.user-a-group-a').text('Incorrect. User A is a member of Group A, as shown in the membership policy table.').addClass('incorrect').removeClass('correct');
}
}
}
function evaluateMembershipB() {
var userAGroupB = $('#user-a-group-b').val();
if (userAGroupB) {
if (userAGroupB === 'yes') {
$('.user-a-group-b').text('Correct - User A is a member of Group A and Group A is a member of Group B. Therefore, User A is also a member of Group B.').addClass('correct').removeClass('incorrect');
} else {
$('.user-a-group-b').text('Incorrect - User A is a member of Group A and Group A is a member of Group B. Therefore, User A is also a member of Group B.').addClass('incorrect').removeClass('correct');
}
}
}
function evaluateMembershipC() {
var userAGroupC = $('#user-a-group-c').val();
if (userAGroupC) {
if (userAGroupC === 'no') {
$('.user-a-group-c').text('Correct - User A is not a member of Group C, as there is no indication of User A being a member of Group C in the membership policy table.').addClass('correct').removeClass('incorrect');
} else {
$('.user-a-group-c').text('Incorrect - User A is not a member of Group C, as there is no indication of User A being a member of Group C in the membership policy table.').addClass('incorrect').removeClass('correct');
}
}
}
});
</script>
</div>
<div>
<h1>Task #3-2</h1>
<p><strong>Task Description:</strong> In this task, you will be presented with a diagram that illustrates membership policies, and a membership evaluation table. Please use the information provided in the diagram to answer the questions in the membership evaluation table.</p>
<h2>Membership Policy Diagram</h2>
<img src="https://user-images.githubusercontent.com/14087400/229548818-1ee64a08-87ec-47c4-8bc3-f8a5ddaf0284.png" alt="Membership Policy Diagram" />
<h2>Membership Evaluation</h2>
<table>
<thead>
<tr>
<th>User</th>
<th>Is User A a member of Group A?</th>
<th>Is User A a member of Group B?</th>
<th>Is User A a member of Group C?</th>
</tr>
</thead>
<tbody>
<tr>
<td>User A</td>
<td>
<select id="task3-2-user-a-group-a">
<option value="">Select option</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</td>
<td>
<select id="task3-2-user-a-group-b">
<option value="">Select option</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</td>
<td>
<select id="task3-2-user-a-group-c">
<option value="">Select option</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</td>
</tr>
</tbody>
</table>
<div class="feedback">
<h2>Feedback:</h2>
<ul>
<li class="task3-2-user-a-group-a"></li>
<li class="task3-2-user-a-group-b"></li>
<li class="task3-2-user-a-group-c"></li>
</ul>
</div>
<script>
$(document).ready(function () {
$('#task3-2-user-a-group-a').change(function () {
evaluateMembershipA();
});
$('#task3-2-user-a-group-b').change(function () {
evaluateMembershipB();
});
$('#task3-2-user-a-group-c').change(function () {
evaluateMembershipC();
});
function evaluateMembershipA() {
var userAGroupA = $('#task3-2-user-a-group-a').val();
if (userAGroupA) {
if (userAGroupA === 'yes') {
$('.task3-2-user-a-group-a').text('Correct - User A is a member of Group A, as shown in the membership policy diagram.').addClass('correct').removeClass('incorrect');
} else {
$('.task3-2-user-a-group-a').text('Incorrect. User A is a member of Group A, as shown in the membership policy diagram.').addClass('incorrect').removeClass('correct');
}
}
}
function evaluateMembershipB() {
var userAGroupB = $('#task3-2-user-a-group-b').val();
if (userAGroupB) {
if (userAGroupB === 'yes') {
$('.task3-2-user-a-group-b').text('Correct - User A is a member of Group A and Group A is a member of Group B. Therefore, User A is also a member of Group B.').addClass('correct').removeClass('incorrect');
} else {
$('.task3-2-user-a-group-b').text('Incorrect - User A is a member of Group A and Group A is a member of Group B. Therefore, User A is also a member of Group B.').addClass('incorrect').removeClass('correct');
}
}
}
function evaluateMembershipC() {
var userAGroupC = $('#task3-2-user-a-group-c').val();
if (userAGroupC) {
if (userAGroupC === 'no') {
$('.task3-2-user-a-group-c').text('Correct - User A is not a member of Group C, as there is no indication of User A being a member of Group C in the membership policy diagram.').addClass('correct').removeClass('incorrect');
} else {
$('.task3-2-user-a-group-c').text('Incorrect - User A is not a member of Group C, as there is no indication of User A being a member of Group C in the membership policy diagram.').addClass('incorrect').removeClass('correct');
}
}
}
});
</script>
</div>
<div>
<h1>Task #4</h1>
<p><strong>Task Description:</strong> In this task, you are provided with two tables - a permission policy table and
a membership policy table.
Please select all the relevant policies that are needed to determine whether User A can access certain resources.</p>
<h2>Permission Policy</h2>
<table>
<thead>
<tr>
<th>Policy</th>
<th>Role</th>
<th>Resource</th>
<th>Permission</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>HR team</td>
<td>Employee performance data</td>
<td>ALLOW</td>
<td>Policy A allows the HR team to access employee performance data.</td>
</tr>
<tr>
<td>B</td>
<td>Payroll team</td>
<td>Salary data</td>
<td>ALLOW</td>
<td>Policy B allows the Payroll team to access salary data.</td>
</tr>
</tbody>
</table>
<h2>Membership Policy</h2>
<table>
<thead>
<tr>
<th>Policy</th>
<th>Member</th>
<th>Group</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>C</td>
<td>User A</td>
<td>Payroll team</td>
<td>User A is a member of the Payroll team.</td>
</tr>
<tr>
<td>D</td>
<td>Payroll team</td>
<td>HR team</td>
<td>The Payroll team is a member of the HR team.</td>
</tr>
</tbody>
</table>
<div class="activity">
<h2>Select all the Relevant Policies</h2>
<p>Select all the relevant policies that are needed to determine whether User A can access employee performance data:</p>
<form id="task4-form">
<div class="policy">
<input type="checkbox" id="task4-policy-a">
<label for="task4-policy-a">Policy A</label>
</div>
<div class="policy">
<input type="checkbox" id="task4-policy-b">
<label for="task4-policy-b">Policy B</label>
</div>
<div class="policy">
<input type="checkbox" id="task4-policy-c">
<label for="task4-policy-c">Policy C</label>
</div>
<div class="policy">
<input type="checkbox" id="task4-policy-d">
<label for="task4-policy-d">Policy D</label>
</div>
<button type="submit">Submit</button>
</form>
<div id="task4-feedback"></div>
</div>
<script>
$(document).ready(function () {
$('#task4-form').submit(function (event) {
event.preventDefault();
var policyASelected = $('#task4-policy-a').prop('checked');
var policyBSelected = $('#task4-policy-b').prop('checked');
var policyCSelected = $('#task4-policy-c').prop('checked');
var policyDSelected = $('#task4-policy-d').prop('checked');
if (policyASelected && policyCSelected && policyDSelected && !policyBSelected) {
$('#task4-feedback').html('<p class="result correct">Correct! Policies A, C, and D are needed to determine whether User A can access employee performance data.</p>');
} else {
var missingPolicies = [];
if (!policyASelected) {
missingPolicies.push('Policy A');
}
if (!policyCSelected) {
missingPolicies.push('Policy C');
}
if (!policyDSelected) {
missingPolicies.push('Policy D');
}
if (policyBSelected) {
$('#task4-feedback').html('<p class="result incorrect">Incorrect. Policy B is not needed to determine whether User A can access employee performance data.</p>');
} else if (missingPolicies.length === 1) {
$('#task4-feedback').html('<p class="result incorrect">Incorrect. The missing policy is: ' + missingPolicies[0] + '.</p>');
} else if (missingPolicies.length > 1) {
$('#task4-feedback').html('<p class="result incorrect">Incorrect. The missing policies are: ' + missingPolicies.join(', ') + '.</p>');
} else {
$('#task4-feedback').html('<p class="result incorrect">Incorrect. Please select the policies that are needed to determine whether User A can access employee performance data.</p>');
}
}
});
});
</script>
<div class="activity">
<h2>Permission Evaluation</h2>
<form id="task4-form2">
<label for="task4-q2-permission">Please select whether the system should ALLOW or DENY User A's access to employee performance data:</label>
<select id="task4-q2-permission">
<option value="">Select option</option>
<option value="allow">ALLOW</option>
<option value="deny">DENY</option>
</select>
<button type="submit">Submit</button>
</form>
<div id="task4-feedback2"></div>
</div>
<script>
$(document).ready(function () {
$('#task4-form2').submit(function (event) {
event.preventDefault();
var selectedPermission = $('#task4-q2-permission').val();
if (selectedPermission === 'allow') {
$('#task4-feedback2').html('<p class="result correct">Correct! User A is allowed to access employee performance data.</p>');
} else {
$('#task4-feedback2').html('<p class="result incorrect">Incorrect. User A is allowed to access employee performance data.</p>');
}
});
});
</script>
</div>
<div>
<h1>Task #5</h1>
<p><strong>Task Description:</strong> In this task, you are provided with:</p>
<ul>
<li>Two tables - a permission policy table and a membership policy table</li>
<li>An interactive table named "Permission Evaluation"</li>
</ul>
<p>The "Permission Evaluation" table contains a sequence of questions. You need to answer the questions by
selecting
the correct option from the drop-down menu. The table will then display whether your answer is correct or not.
</p>
<h2>Permission Policy</h2>
<table>
<tr>
<th>Policy</th>
<th>Role</th>
<th>Resource</th>
<th>Permission</th>
<th>Description</th>
</tr>
<tr>
<td>A</td>
<td>HR team</td>
<td>Employee performance data</td>
<td>ALLOW</td>
<td>Policy A allows the HR team to access employee performance data.</td>
</tr>
<tr>
<td>B</td>
<td>Payroll team</td>
<td>Salary data</td>
<td>ALLOW</td>
<td>Policy B allows the Payroll team to access salary data.</td>
</tr>
</table>
<h2>Membership policy</h2>
<table>
<tr>
<th>Policy</th>
<th>Member</th>
<th>Group</th>
<th>Description</th>
</tr>
<tr>
<td>C</td>
<td>User A</td>
<td>Payroll team</td>
<td>User A is a member of the Payroll team</td>
</tr>
<tr>
<td>D</td>
<td>Payroll team</td>
<td>HR team</td>
<td>The Payroll team is a member of the HR team</td>
</tr>
</table>
<!--
A "Permission Evaluation" table:
This is an interactive table that ask the learner to enter whether a user can access certain resources.
The learner can enter "ALLOW" or "DENY" in the input field.
The table will then display the correctness of the user's input.
The table contains the following questions:
whether User A can access Employee performance data
whether User A can access Salary data
whether User A can access Financial data
-->
<h2>Permission Evaluation</h2>
<table>
<tr>
<th>Entity</th>
<th>Resource</th>
<th>Permission</th>
<th>Feedback</th>
</tr>
<tr>
<td>User A</td>
<td>Employee performance data</td>
<td>
<select id="q1">
<option value="">Select an option</option>
<option value="ALLOW">ALLOW</option>
<option value="DENY">DENY</option>
<option value="I don't know">I don't know</option>
</select>
</td>
<td id="ans1"></td>
</tr>
<tr>
<td>User A</td>
<td>Salary data</td>
<td>
<select id="q2">
<option value="">Select an option</option>
<option value="ALLOW">ALLOW</option>
<option value="DENY">DENY</option>
<option value="I don't know">I don't know</option>
</select>
</td>
<td id="ans2"></td>
</tr>
<tr>
<td>User A</td>
<td>Financial data</td>
<td>
<select id="q3">
<option value="">Select an option</option>
<option value="ALLOW">ALLOW</option>
<option value="DENY">DENY</option>
<option value="I don't know">I don't know</option>
</select>
</td>
<td id="ans3"></td>
</tr>
</table>
<script>
const ans1 = "ALLOW";
const ans2 = "ALLOW";
const ans3 = "DENY";
const q1 = document.getElementById("q1");
const q2 = document.getElementById("q2");
const q3 = document.getElementById("q3");
const a1 = document.getElementById("ans1");
const a2 = document.getElementById("ans2");
const a3 = document.getElementById("ans3");
q1.addEventListener("blur", checkAnswer1);
q2.addEventListener("blur", checkAnswer2);
q3.addEventListener("blur", checkAnswer3);
function checkAnswer1() {
if (q1.value.toUpperCase() === ans1) {
a1.innerHTML = "Correct";
a1.className = "correct";
} else {
a1.innerHTML = "Incorrect. Please refer to policy C, D, and A.";
a1.className = "incorrect";
}
}
function checkAnswer2() {
if (q2.value.toUpperCase() === ans2) {
a2.innerHTML = "Correct";
a2.className = "correct";
} else {
a2.innerHTML = "Incorrect. Please refer to policy C and B.";
a2.className = "incorrect";
}
}
function checkAnswer3() {
if (q3.value.toUpperCase() === ans3) {
a3.innerHTML = "Correct";
a3.className = "correct";
} else {
a3.innerHTML = "Incorrect. No policy allows User A to access Financial data.";
a3.className = "incorrect";
}
}
</script>
</div>
</body>
</html>