This is an automated email from the ASF dual-hosted git repository.
smolnar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git
The following commit(s) were added to refs/heads/master by this push:
new 7a5189a7c KNOX-2975, KNOX-2976 - Expired tokens must not be
enabled/disabled in batches (#812)
7a5189a7c is described below
commit 7a5189a7c0c51f3e2c0b9cd2bf03bbbbb4df0415
Author: Sandor Molnar <[email protected]>
AuthorDate: Mon Oct 30 11:26:16 2023 +0100
KNOX-2975, KNOX-2976 - Expired tokens must not be enabled/disabled in
batches (#812)
Additionally, useful tips are shown on why batch operation actions are
hidden (e.g. KnoxSSO Cookies must not be revoked).
---
.../token-management/app/token.management.component.html | 11 +++++++++++
.../token-management/app/token.management.component.ts | 8 ++++++--
.../token-management/assets/yellow_tip.png | Bin 0 -> 4748 bytes
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git
a/knox-token-management-ui/token-management/app/token.management.component.html
b/knox-token-management-ui/token-management/app/token.management.component.html
index ca93fef22..f011251da 100644
---
a/knox-token-management-ui/token-management/app/token.management.component.html
+++
b/knox-token-management-ui/token-management/app/token.management.component.html
@@ -137,5 +137,16 @@
<button *ngIf="showEnableSelectedTokensButton" type="button"
(click)="enableSelectedTokens();"> Enable Selected
Tokens </button>
<button *ngIf="showRevokeSelectedTokensButton" type="button"
(click)="revokeSelectedTokens();"> Revoke Selected Tokens </button>
</div>
+
+ <div *ngIf="!selection.isEmpty() && !showDisableSelectedTokensButton"
style="margin-top: 25px;">
+ <img src="assets/yellow_tip.png" style="height:30px; width:auto" />
Expired tokens cannot be disabled in batches (nor individually).
+ </div>
+ <div *ngIf="!selection.isEmpty() && !showEnableSelectedTokensButton"
style="margin-top: 25px;">
+ <img src="assets/yellow_tip.png" style="height:30px; width:auto" />
Expired tokens cannot be enabed in batches (nor individually).
+ </div>
+ <div *ngIf="!selection.isEmpty() && !showRevokeSelectedTokensButton"
style="margin-top: 25px;">
+ <img src="assets/yellow_tip.png" style="height:30px; width:auto" />
KnoxSSO Cookies cannot be revoked in batches (nor individually).
+ </div>
+
</div>
diff --git
a/knox-token-management-ui/token-management/app/token.management.component.ts
b/knox-token-management-ui/token-management/app/token.management.component.ts
index daa210127..7ed486c1c 100644
---
a/knox-token-management-ui/token-management/app/token.management.component.ts
+++
b/knox-token-management-ui/token-management/app/token.management.component.ts
@@ -262,8 +262,8 @@ export class TokenManagementComponent implements OnInit {
this.showEnableSelectedTokensButton = false;
this.showRevokeSelectedTokensButton = false;
} else {
- this.showDisableSelectedTokensButton = true;
- this.showEnableSelectedTokensButton = true;
+ this.showDisableSelectedTokensButton =
this.selectionHasZeroExpiredToken(); // expired tokens must not be disabled
+ this.showEnableSelectedTokensButton =
this.selectionHasZeroExpiredToken(); // expired tokens must not be enabled
this.showRevokeSelectedTokensButton =
this.selectionHasZeroKnoxSsoCookie(); // KnoxSSO cookies must not be revoked
}
}
@@ -272,6 +272,10 @@ export class TokenManagementComponent implements OnInit {
return this.selection.selected.every(token =>
!token.metadata.knoxSsoCookie);
}
+ private selectionHasZeroExpiredToken(): boolean {
+ return this.selection.selected.every(token =>
!this.isTokenExpired(token.expirationLong));
+ }
+
getFontWeight(token: KnoxToken): string {
return this.isCurrentKnoxSsoCookietoken(token) ? 'bold' : 'normal';
}
diff --git a/knox-token-management-ui/token-management/assets/yellow_tip.png
b/knox-token-management-ui/token-management/assets/yellow_tip.png
new file mode 100644
index 000000000..7b2397f6e
Binary files /dev/null and
b/knox-token-management-ui/token-management/assets/yellow_tip.png differ