Browse Source

Add write access

pull/7676/head
Thomas Kaul 1 week ago
parent
commit
bf4df58dda
  1. 12
      apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts
  2. 8
      apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html
  3. 3
      apps/client/src/app/components/user-account-access/create-or-update-access-dialog/interfaces/interfaces.ts

12
apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.component.ts

@ -156,7 +156,7 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit {
// A public access never exposes the monetary values and never
// changes data
this.accessForm.get('accessLevel')?.setValue('RESTRICTED_VIEW');
this.accessForm.get('accessLevel')?.setValue('READ_RESTRICTED');
}
granteeUserIdControl?.updateValueAndValidity();
@ -187,9 +187,9 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit {
private buildScopes(): Scope[] {
switch (this.accessForm.get('accessLevel')?.value as AccessLevel) {
case 'CHANGE':
case 'CREATE_READ_UPDATE_DELETE':
return [...SCOPES_OF_READ_ACCESS, ...SCOPES_OF_WRITE_ACCESS];
case 'VIEW':
case 'READ':
return [...SCOPES_OF_READ_ACCESS];
default:
return [...SCOPES_OF_READ_RESTRICTED_ACCESS];
@ -241,12 +241,12 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit {
return hasScope(scopesOfAccess, scope);
})
) {
return 'CHANGE';
return 'CREATE_READ_UPDATE_DELETE';
}
return hasScope(scopesOfAccess, scopes.portfolioReadValues)
? 'VIEW'
: 'RESTRICTED_VIEW';
? 'READ'
: 'READ_RESTRICTED';
}
private loadHoldings() {

8
apps/client/src/app/components/user-account-access/create-or-update-access-dialog/create-or-update-access-dialog.html

@ -37,10 +37,12 @@
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Permission</mat-label>
<mat-select formControlName="accessLevel">
<mat-option i18n value="RESTRICTED_VIEW">Restricted view</mat-option>
<mat-option i18n value="READ_RESTRICTED">Restricted view</mat-option>
@if (accessForm.get('type')?.value === 'PRIVATE') {
<mat-option i18n value="VIEW">View</mat-option>
<mat-option i18n value="CHANGE">View and change</mat-option>
<mat-option i18n value="READ">View</mat-option>
<mat-option i18n value="CREATE_READ_UPDATE_DELETE"
>View and manage</mat-option
>
}
</mat-select>
</mat-form-field>

3
apps/client/src/app/components/user-account-access/create-or-update-access-dialog/interfaces/interfaces.ts

@ -4,4 +4,5 @@ export interface CreateOrUpdateAccessDialogParams {
access?: Access;
}
export type AccessLevel = 'CHANGE' | 'RESTRICTED_VIEW' | 'VIEW';
export type AccessLevel =
'CREATE_READ_UPDATE_DELETE' | 'READ' | 'READ_RESTRICTED';

Loading…
Cancel
Save