Skip to content

Commit

Permalink
NAS-125779: Changing privilege on a group does not update group in th…
Browse files Browse the repository at this point in the history
…e table (#9356)
  • Loading branch information
AlexKarpov98 authored Dec 21, 2023
1 parent d4e0296 commit db90310
Show file tree
Hide file tree
Showing 90 changed files with 1,450 additions and 3 deletions.
35 changes: 34 additions & 1 deletion src/app/enums/role.enum.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { marker as T } from '@biesbjerg/ngx-translate-extract-marker';

export enum Role {
ReportingRead = 'REPORTING_READ',
AlertListRead = 'ALERT_LIST_READ',
AuthSessionsRead = 'AUTH_SESSIONS_READ',
AuthSessionsWrite = 'AUTH_SESSIONS_WRITE',
Expand All @@ -15,6 +14,7 @@ export enum Role {
FilesystemFullControl = 'FILESYSTEM_FULL_CONTROL',
FullAdmin = 'FULL_ADMIN',
HasAllowList = 'HAS_ALLOW_LIST',
LocalAdministrator = 'LOCAL_ADMINISTRATOR',
KeychainCredentialRead = 'KEYCHAIN_CREDENTIAL_READ',
KeychainCredentialWrite = 'KEYCHAIN_CREDENTIAL_WRITE',
NetworkGeneralRead = 'NETWORK_GENERAL_READ',
Expand Down Expand Up @@ -57,6 +57,22 @@ export enum Role {
SnapshotTaskRead = 'SNAPSHOT_TASK_READ',
SnapshotTaskWrite = 'SNAPSHOT_TASK_WRITE',
SnapshotWrite = 'SNAPSHOT_WRITE',
AccountRead = 'ACCOUNT_READ',
AccountWrite = 'ACCOUNT_WRITE',
CloudSyncRead = 'CLOUD_SYNC_READ',
CloudSyncWrite = 'CLOUD_SYNC_WRITE',
EnclosureRead = 'ENCLOSURE_READ',
EnclosureWrite = 'ENCLOSURE_WRITE',
KmipRead = 'KMIP_READ',
KmipWrite = 'KMIP_WRITE',
ReportingRead = 'REPORTING_READ',
ReportingWrite = 'REPORTING_WRITE',
ServiceRead = 'SERVICE_READ',
ServiceWrite = 'SERVICE_WRITE',
SupportRead = 'SUPPORT_READ',
SupportWrite = 'SUPPORT_WRITE',
SystemAuditRead = 'SYSTEM_AUDIT_READ',
SystemAuditWrite = 'SYSTEM_AUDIT_WRITE',
}

export const roleNames = new Map<Role, string>([
Expand All @@ -73,6 +89,7 @@ export const roleNames = new Map<Role, string>([
[Role.FilesystemFullControl, T('Filesystem Full Control')],
[Role.FullAdmin, T('Full Admin')],
[Role.HasAllowList, T('Has Allow List')],
[Role.LocalAdministrator, T('Local Administrator')],
[Role.KeychainCredentialRead, T('Keychain Credential Read')],
[Role.KeychainCredentialWrite, T('Keychain Credential Write')],
[Role.NetworkGeneralRead, T('Network General Read')],
Expand Down Expand Up @@ -118,4 +135,20 @@ export const roleNames = new Map<Role, string>([
[Role.AuthSessionsRead, T('Auth Sessions Read')],
[Role.AuthSessionsWrite, T('Auth Sessions Write')],
[Role.ReportingRead, T('Reporting Read')],
[Role.AccountRead, T('Account Read')],
[Role.AccountWrite, T('Account Write')],
[Role.CloudSyncRead, T('Cloud Sync Read')],
[Role.CloudSyncWrite, T('Cloud Sync Write')],
[Role.EnclosureRead, T('Enclosure Read')],
[Role.EnclosureWrite, T('Enclosure Write')],
[Role.KmipRead, T('KMIP Read')],
[Role.KmipWrite, T('KMIP Write')],
[Role.ReportingRead, T('Reporting Read')],
[Role.ReportingWrite, T('Reporting Write')],
[Role.ServiceRead, T('Service Read')],
[Role.ServiceWrite, T('Service Write')],
[Role.SupportRead, T('Support Read')],
[Role.SupportWrite, T('Support Write')],
[Role.SystemAuditRead, T('System Audit Read')],
[Role.SystemAuditWrite, T('System Audit Write')],
]);
10 changes: 8 additions & 2 deletions src/app/pages/account/groups/group-form/group-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
import { allCommands } from 'app/constants/all-commands.constant';
import { Role } from 'app/enums/role.enum';
import { helptextGroups } from 'app/helptext/account/groups';
import { Group } from 'app/interfaces/group.interface';
import { Privilege, PrivilegeUpdate } from 'app/interfaces/privilege.interface';
Expand Down Expand Up @@ -153,13 +154,18 @@ export class GroupFormComponent implements OnInit {
untilDestroyed(this),
).subscribe({
next: (group) => {
const roles = this.privilegesList
.filter((privilege) => this.form.value.privileges.some((id) => id === privilege.id))
.map((role) => role.builtin_name) as Role[];

if (this.isNew) {
this.snackbar.success(this.translate.instant('Group added'));
this.store$.dispatch(groupAdded({ group }));
this.store$.dispatch(groupAdded({ group: { ...group, roles } }));
} else {
this.snackbar.success(this.translate.instant('Group updated'));
this.store$.dispatch(groupChanged({ group }));
this.store$.dispatch(groupChanged({ group: { ...group, roles } }));
}

this.isFormLoading = false;
this.slideInRef.close();
this.cdr.markForCheck();
Expand Down
16 changes: 16 additions & 0 deletions src/assets/i18n/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
"Access restricted": "",
"Account Key": "",
"Account Name": "",
"Account Read": "",
"Account Write": "",
"Account to be used for guest access. Default is <i>nobody</i>. The chosen account is required to have permissions to the shared pool or dataset. To adjust permissions, edit the dataset Access Control List (ACL), add a new entry for the chosen guest account, and configure the permissions in that entry. If the selected <i>Guest Account</i> is deleted the field resets to <i>nobody</i>.": "",
"Account: {account}": "",
"Ace has errors.": "",
Expand Down Expand Up @@ -765,7 +767,9 @@
"Close the form": "",
"Cloud Credentials": "",
"Cloud Sync": "",
"Cloud Sync Read": "",
"Cloud Sync Tasks": "",
"Cloud Sync Write": "",
"Cloud Sync to Storj or similar provider": "",
"Cloud Sync «{name}» has started.": "",
"Cloud Sync «{name}» stopped.": "",
Expand Down Expand Up @@ -1375,6 +1379,8 @@
"Encipher Only": "",
"Enclosure": "",
"Enclosure Options": "",
"Enclosure Read": "",
"Enclosure Write": "",
"Encode information in less space than the original data occupies. It is recommended to choose a compression algorithm that balances disk performance with the amount of saved space.<br> <i>LZ4</i> is generally recommended as it maximizes performance and dynamically identifies the best files to compress.<br> <i>GZIP</i> options range from 1 for least compression, best performance, through 9 for maximum compression with greatest performance impact.<br> <i>ZLE</i> is a fast algorithm that only eliminates runs of zeroes.": "",
"Encrypted Datasets": "",
"Encryption": "",
Expand Down Expand Up @@ -2021,7 +2027,9 @@
"KDC": "",
"KMIP": "",
"KMIP Key Status": "",
"KMIP Read": "",
"KMIP Server": "",
"KMIP Write": "",
"KVM implements Hyper-V Enlightenments for Windows guests. These features make Windows think they're running on top of a Hyper-V compatible hypervisor and use Hyper-V specific features. In some cases enabling these Enlightenments might improve usability and performance on the guest.": "",
"Keep": "",
"Keep for": "",
Expand Down Expand Up @@ -2134,6 +2142,7 @@
"Loading...": "",
"Local": "",
"Local Account": "",
"Local Administrator": "",
"Local Groups": "",
"Local Master": "",
"Local User Download Bandwidth": "",
Expand Down Expand Up @@ -2930,6 +2939,7 @@
"Reporting": "",
"Reporting Exporters": "",
"Reporting Read": "",
"Reporting Write": "",
"Reports": "",
"Repository": "",
"Requested action performed for selected Applications": "",
Expand Down Expand Up @@ -3307,6 +3317,8 @@
"Service Announcement:": "",
"Service CIDR": "",
"Service Key": "",
"Service Read": "",
"Service Write": "",
"Service configuration saved": "",
"Service failed to start": "",
"Service failed to stop": "",
Expand Down Expand Up @@ -3652,6 +3664,8 @@
"Sunday": "",
"Support": "",
"Support >16 groups": "",
"Support Read": "",
"Support Write": "",
"Swap Size": "",
"Switch To Advanced": "",
"Switch To Basic": "",
Expand Down Expand Up @@ -3681,6 +3695,8 @@
"Syslog TLS Certificate Authority": "",
"Syslog Transport": "",
"System": "",
"System Audit Read": "",
"System Audit Write": "",
"System Clock": "",
"System Dataset": "",
"System Dataset Pool": "",
Expand Down
16 changes: 16 additions & 0 deletions src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
"Access restricted": "",
"Account Key": "",
"Account Name": "",
"Account Read": "",
"Account Write": "",
"Account to be used for guest access. Default is <i>nobody</i>. The chosen account is required to have permissions to the shared pool or dataset. To adjust permissions, edit the dataset Access Control List (ACL), add a new entry for the chosen guest account, and configure the permissions in that entry. If the selected <i>Guest Account</i> is deleted the field resets to <i>nobody</i>.": "",
"Account: {account}": "",
"Ace has errors.": "",
Expand Down Expand Up @@ -765,7 +767,9 @@
"Close the form": "",
"Cloud Credentials": "",
"Cloud Sync": "",
"Cloud Sync Read": "",
"Cloud Sync Tasks": "",
"Cloud Sync Write": "",
"Cloud Sync to Storj or similar provider": "",
"Cloud Sync «{name}» has started.": "",
"Cloud Sync «{name}» stopped.": "",
Expand Down Expand Up @@ -1375,6 +1379,8 @@
"Encipher Only": "",
"Enclosure": "",
"Enclosure Options": "",
"Enclosure Read": "",
"Enclosure Write": "",
"Encode information in less space than the original data occupies. It is recommended to choose a compression algorithm that balances disk performance with the amount of saved space.<br> <i>LZ4</i> is generally recommended as it maximizes performance and dynamically identifies the best files to compress.<br> <i>GZIP</i> options range from 1 for least compression, best performance, through 9 for maximum compression with greatest performance impact.<br> <i>ZLE</i> is a fast algorithm that only eliminates runs of zeroes.": "",
"Encrypted Datasets": "",
"Encryption": "",
Expand Down Expand Up @@ -2021,7 +2027,9 @@
"KDC": "",
"KMIP": "",
"KMIP Key Status": "",
"KMIP Read": "",
"KMIP Server": "",
"KMIP Write": "",
"KVM implements Hyper-V Enlightenments for Windows guests. These features make Windows think they're running on top of a Hyper-V compatible hypervisor and use Hyper-V specific features. In some cases enabling these Enlightenments might improve usability and performance on the guest.": "",
"Keep": "",
"Keep for": "",
Expand Down Expand Up @@ -2134,6 +2142,7 @@
"Loading...": "",
"Local": "",
"Local Account": "",
"Local Administrator": "",
"Local Groups": "",
"Local Master": "",
"Local User Download Bandwidth": "",
Expand Down Expand Up @@ -2930,6 +2939,7 @@
"Reporting": "",
"Reporting Exporters": "",
"Reporting Read": "",
"Reporting Write": "",
"Reports": "",
"Repository": "",
"Requested action performed for selected Applications": "",
Expand Down Expand Up @@ -3307,6 +3317,8 @@
"Service Announcement:": "",
"Service CIDR": "",
"Service Key": "",
"Service Read": "",
"Service Write": "",
"Service configuration saved": "",
"Service failed to start": "",
"Service failed to stop": "",
Expand Down Expand Up @@ -3652,6 +3664,8 @@
"Sunday": "",
"Support": "",
"Support >16 groups": "",
"Support Read": "",
"Support Write": "",
"Swap Size": "",
"Switch To Advanced": "",
"Switch To Basic": "",
Expand Down Expand Up @@ -3681,6 +3695,8 @@
"Syslog TLS Certificate Authority": "",
"Syslog Transport": "",
"System": "",
"System Audit Read": "",
"System Audit Write": "",
"System Clock": "",
"System Dataset": "",
"System Dataset Pool": "",
Expand Down
16 changes: 16 additions & 0 deletions src/assets/i18n/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
"Access restricted": "",
"Account Key": "",
"Account Name": "",
"Account Read": "",
"Account Write": "",
"Account to be used for guest access. Default is <i>nobody</i>. The chosen account is required to have permissions to the shared pool or dataset. To adjust permissions, edit the dataset Access Control List (ACL), add a new entry for the chosen guest account, and configure the permissions in that entry. If the selected <i>Guest Account</i> is deleted the field resets to <i>nobody</i>.": "",
"Account: {account}": "",
"Ace has errors.": "",
Expand Down Expand Up @@ -765,7 +767,9 @@
"Close the form": "",
"Cloud Credentials": "",
"Cloud Sync": "",
"Cloud Sync Read": "",
"Cloud Sync Tasks": "",
"Cloud Sync Write": "",
"Cloud Sync to Storj or similar provider": "",
"Cloud Sync «{name}» has started.": "",
"Cloud Sync «{name}» stopped.": "",
Expand Down Expand Up @@ -1375,6 +1379,8 @@
"Encipher Only": "",
"Enclosure": "",
"Enclosure Options": "",
"Enclosure Read": "",
"Enclosure Write": "",
"Encode information in less space than the original data occupies. It is recommended to choose a compression algorithm that balances disk performance with the amount of saved space.<br> <i>LZ4</i> is generally recommended as it maximizes performance and dynamically identifies the best files to compress.<br> <i>GZIP</i> options range from 1 for least compression, best performance, through 9 for maximum compression with greatest performance impact.<br> <i>ZLE</i> is a fast algorithm that only eliminates runs of zeroes.": "",
"Encrypted Datasets": "",
"Encryption": "",
Expand Down Expand Up @@ -2021,7 +2027,9 @@
"KDC": "",
"KMIP": "",
"KMIP Key Status": "",
"KMIP Read": "",
"KMIP Server": "",
"KMIP Write": "",
"KVM implements Hyper-V Enlightenments for Windows guests. These features make Windows think they're running on top of a Hyper-V compatible hypervisor and use Hyper-V specific features. In some cases enabling these Enlightenments might improve usability and performance on the guest.": "",
"Keep": "",
"Keep for": "",
Expand Down Expand Up @@ -2134,6 +2142,7 @@
"Loading...": "",
"Local": "",
"Local Account": "",
"Local Administrator": "",
"Local Groups": "",
"Local Master": "",
"Local User Download Bandwidth": "",
Expand Down Expand Up @@ -2930,6 +2939,7 @@
"Reporting": "",
"Reporting Exporters": "",
"Reporting Read": "",
"Reporting Write": "",
"Reports": "",
"Repository": "",
"Requested action performed for selected Applications": "",
Expand Down Expand Up @@ -3307,6 +3317,8 @@
"Service Announcement:": "",
"Service CIDR": "",
"Service Key": "",
"Service Read": "",
"Service Write": "",
"Service configuration saved": "",
"Service failed to start": "",
"Service failed to stop": "",
Expand Down Expand Up @@ -3652,6 +3664,8 @@
"Sunday": "",
"Support": "",
"Support >16 groups": "",
"Support Read": "",
"Support Write": "",
"Swap Size": "",
"Switch To Advanced": "",
"Switch To Basic": "",
Expand Down Expand Up @@ -3681,6 +3695,8 @@
"Syslog TLS Certificate Authority": "",
"Syslog Transport": "",
"System": "",
"System Audit Read": "",
"System Audit Write": "",
"System Clock": "",
"System Dataset": "",
"System Dataset Pool": "",
Expand Down
Loading

0 comments on commit db90310

Please sign in to comment.