mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-06-09 07:09:43 +00:00
Feature: Allow monitoring access to tasks summary (#12624)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
@@ -337,7 +337,7 @@ describe('SettingsComponent', () => {
|
||||
.mockImplementation(
|
||||
(action, type) =>
|
||||
action === PermissionAction.View &&
|
||||
type === PermissionType.SystemStatus
|
||||
type === PermissionType.SystemMonitoring
|
||||
)
|
||||
completeSetup()
|
||||
expect(component['systemStatus']).toEqual(status) // private
|
||||
@@ -359,7 +359,7 @@ describe('SettingsComponent', () => {
|
||||
.mockImplementation(
|
||||
(action, type) =>
|
||||
action === PermissionAction.View &&
|
||||
type === PermissionType.SystemStatus
|
||||
type === PermissionType.SystemMonitoring
|
||||
)
|
||||
completeSetup()
|
||||
component.showSystemStatus()
|
||||
|
||||
@@ -652,7 +652,7 @@ export class SettingsComponent
|
||||
this.permissionsService.isAdmin() ||
|
||||
this.permissionsService.currentUserCan(
|
||||
PermissionAction.View,
|
||||
PermissionType.SystemStatus
|
||||
PermissionType.SystemMonitoring
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
+5
-5
@@ -133,28 +133,28 @@ describe('PermissionsSelectComponent', () => {
|
||||
expect(viewInput.nativeElement.disabled).toBeFalsy()
|
||||
})
|
||||
|
||||
it('should treat system status as view-only', () => {
|
||||
it('should treat system monitoring as view-only', () => {
|
||||
component.ngOnInit()
|
||||
fixture.detectChanges()
|
||||
|
||||
expect(
|
||||
component.isActionSupported(
|
||||
PermissionType.SystemStatus,
|
||||
PermissionType.SystemMonitoring,
|
||||
PermissionAction.View
|
||||
)
|
||||
).toBeTruthy()
|
||||
expect(
|
||||
component.isActionSupported(
|
||||
PermissionType.SystemStatus,
|
||||
PermissionType.SystemMonitoring,
|
||||
PermissionAction.Change
|
||||
)
|
||||
).toBeFalsy()
|
||||
|
||||
const changeInput = fixture.debugElement.query(
|
||||
By.css('input#SystemStatus_Change')
|
||||
By.css('input#SystemMonitoring_Change')
|
||||
)
|
||||
const viewInput = fixture.debugElement.query(
|
||||
By.css('input#SystemStatus_View')
|
||||
By.css('input#SystemMonitoring_View')
|
||||
)
|
||||
|
||||
expect(changeInput.nativeElement.disabled).toBeTruthy()
|
||||
|
||||
@@ -261,7 +261,7 @@ export class PermissionsSelectComponent
|
||||
// Global statistics and system status only support view
|
||||
if (
|
||||
type === PermissionType.GlobalStatistics ||
|
||||
type === PermissionType.SystemStatus
|
||||
type === PermissionType.SystemMonitoring
|
||||
) {
|
||||
return action === PermissionAction.View
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
|
||||
const VIEW_ONLY_PERMISSION_TYPES = new Set<PermissionType>([
|
||||
PermissionType.GlobalStatistics,
|
||||
PermissionType.SystemStatus,
|
||||
PermissionType.SystemMonitoring,
|
||||
])
|
||||
|
||||
describe('PermissionsService', () => {
|
||||
@@ -270,7 +270,7 @@ describe('PermissionsService', () => {
|
||||
'delete_applicationconfiguration',
|
||||
'view_applicationconfiguration',
|
||||
'view_global_statistics',
|
||||
'view_system_status',
|
||||
'view_system_monitoring',
|
||||
],
|
||||
{
|
||||
username: 'testuser',
|
||||
|
||||
@@ -30,7 +30,7 @@ export enum PermissionType {
|
||||
Workflow = '%s_workflow',
|
||||
ProcessedMail = '%s_processedmail',
|
||||
GlobalStatistics = '%s_global_statistics',
|
||||
SystemStatus = '%s_system_status',
|
||||
SystemMonitoring = '%s_system_monitoring',
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
|
||||
Reference in New Issue
Block a user