Skip to content

Commit c927d2c

Browse files
author
Kristan Kenney
committed
Add policy to allow users to delete history logs
1 parent 3f18b8c commit c927d2c

File tree

5 files changed

+50
-23
lines changed

5 files changed

+50
-23
lines changed

bin/v-list-sys-config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ json_list() {
7777
"API_ALLOWED_IP": "'$API_ALLOWED_IP'",
7878
"RESTRICTED_ADMIN": "'$RESTRICTED_ADMIN'",
7979
"HIDE_ADMIN_ACCOUNT": "'$HIDE_ADMIN_ACCOUNT'",
80-
"POLICY_USER_EDIT_DETAILS": "'$POLICY_USER_EDIT_DETAILS'"
80+
"POLICY_USER_EDIT_DETAILS": "'$POLICY_USER_EDIT_DETAILS'",
81+
"POLICY_USER_DELETE_LOGS": "'$POLICY_USER_DELETE_LOGS'"
8182
}
8283
}'
8384
}

web/templates/admin/list_log.html

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@
1717
<? if (($_SESSION['userContext'] === 'admin') && ($_SESSION['user'] !== 'admin') && ($_SESSION['RESTRICTED_ADMIN'] === 'yes')) {?>
1818
<!-- Hide delete buttons-->
1919
<? } else { ?>
20-
<div class="actions-panel display-inline-block" key-action="js">
21-
<a class="data-controls do_delete ui-button danger cancel">
22-
<i class="do_delete fas fa-times-circle status-icon red"></i><?=_('Delete')?>
23-
<? if (($_SESSION['userContext'] === 'admin') && ($_GET['user'] === 'admin')) {?>
24-
<input type="hidden" name="delete_url" value="/delete/log/?user=admin&token=<?=$_SESSION['token']?>" />
25-
<? } else { ?>
26-
<input type="hidden" name="delete_url" value="/delete/log/?token=<?=$_SESSION['token']?>" />
27-
<? } ?>
28-
<div class="confirmation-text-delete hidden" title="<?=_('Confirmation')?>">
29-
<p class="confirmation"><?=_('DELETE_LOGS_CONFIRMATION')?></p>
30-
</div>
31-
</a>
32-
</div>
20+
<? if (($_SESSION['userContext'] === 'admin') || (($_SESSION['userContext'] === 'user') && ($_SESSION['POLICY_USER_DELETE_LOGS'] === 'yes'))) {?>
21+
<div class="actions-panel display-inline-block" key-action="js">
22+
<a class="data-controls do_delete ui-button danger cancel">
23+
<i class="do_delete fas fa-times-circle status-icon red"></i><?=_('Delete')?>
24+
<? if (($_SESSION['userContext'] === 'admin') && ($_GET['user'] === 'admin')) {?>
25+
<input type="hidden" name="delete_url" value="/delete/log/?user=admin&token=<?=$_SESSION['token']?>" />
26+
<? } else { ?>
27+
<input type="hidden" name="delete_url" value="/delete/log/?token=<?=$_SESSION['token']?>" />
28+
<? } ?>
29+
<div class="confirmation-text-delete hidden" title="<?=_('Confirmation')?>">
30+
<p class="confirmation"><?=_('DELETE_LOGS_CONFIRMATION')?></p>
31+
</div>
32+
</a>
33+
</div>
34+
<? } ?>
3335
<? } ?>
3436
</div>
3537
</div>

web/templates/admin/list_log_auth.html

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@
88
<? if (($_SESSION['userContext'] === 'admin') && ($_SESSION['look'] === 'admin') && ($_SESSION['RESTRICTED_ADMIN'] === 'yes')) {?>
99
<!-- Hide delete buttons-->
1010
<? } else { ?>
11-
<div class="actions-panel display-inline-block" key-action="js">
12-
<a class="data-controls do_delete ui-button danger cancel">
13-
<i class="do_delete fas fa-times-circle status-icon red"></i><?=_('Delete')?>
14-
<input type="hidden" name="delete_url" value="/delete/log/auth/?token=<?=$_SESSION['token']?>" />
15-
<div class="confirmation-text-delete hidden" title="<?=_('Confirmation')?>">
16-
<p class="confirmation"><?=_('DELETE_LOGS_CONFIRMATION')?></p>
17-
</div>
18-
</a>
19-
</div>
11+
<? if (($_SESSION['userContext'] === 'admin') || (($_SESSION['userContext'] === 'user') && ($_SESSION['POLICY_USER_DELETE_LOGS'] === 'yes'))) {?>
12+
<div class="actions-panel display-inline-block" key-action="js">
13+
<a class="data-controls do_delete ui-button danger cancel">
14+
<i class="do_delete fas fa-times-circle status-icon red"></i><?=_('Delete')?>
15+
<input type="hidden" name="delete_url" value="/delete/log/auth/?token=<?=$_SESSION['token']?>" />
16+
<div class="confirmation-text-delete hidden" title="<?=_('Confirmation')?>">
17+
<p class="confirmation"><?=_('DELETE_LOGS_CONFIRMATION')?></p>
18+
</div>
19+
</a>
20+
</div>
21+
<? } ?>
2022
<? } ?>
2123
</div>
2224
</div>

web/templates/user/list_log.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
</div>
77
<div class="l-unit-toolbar__buttonstrip float-right">
88
<a href="javascript:location.reload();" class="ui-button cancel" dir="ltr"><i class="fas fa-redo status-icon green"></i><?=_('Refresh')?></a>
9+
<? if (($_SESSION['userContext'] === 'user') && ($_SESSION['POLICY_USER_DELETE_LOGS'] === 'yes')) {?>
10+
<div class="actions-panel display-inline-block" key-action="js">
11+
<a class="data-controls do_delete ui-button danger cancel">
12+
<i class="do_delete fas fa-times-circle status-icon red"></i><?=_('Delete')?>
13+
<input type="hidden" name="delete_url" value="/delete/log/?token=<?=$_SESSION['token']?>" />
14+
<div class="confirmation-text-delete hidden" title="<?=_('Confirmation')?>">
15+
<p class="confirmation"><?=_('DELETE_LOGS_CONFIRMATION')?></p>
16+
</div>
17+
</a>
18+
</div>
19+
<? } ?>
920
</div>
1021
</div>
1122
</div>

web/templates/user/list_log_auth.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
</div>
66
<div class="l-unit-toolbar__buttonstrip float-right">
77
<a href="javascript:location.reload();" class="ui-button cancel" dir="ltr"><i class="fas fa-redo status-icon green"></i><?=_('Refresh')?></a>
8+
<? if (($_SESSION['userContext'] === 'user') && ($_SESSION['POLICY_USER_DELETE_LOGS'] === 'yes')) {?>
9+
<div class="actions-panel display-inline-block" key-action="js">
10+
<a class="data-controls do_delete ui-button danger cancel">
11+
<i class="do_delete fas fa-times-circle status-icon red"></i><?=_('Delete')?>
12+
<input type="hidden" name="delete_url" value="/delete/log/auth/?token=<?=$_SESSION['token']?>" />
13+
<div class="confirmation-text-delete hidden" title="<?=_('Confirmation')?>">
14+
<p class="confirmation"><?=_('DELETE_LOGS_CONFIRMATION')?></p>
15+
</div>
16+
</a>
17+
</div>
18+
<? } ?>
819
</div>
920
</div>
1021
</div>

0 commit comments

Comments
 (0)