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 // A public access never exposes the monetary values and never
// changes data // changes data
this.accessForm.get('accessLevel')?.setValue('RESTRICTED_VIEW'); this.accessForm.get('accessLevel')?.setValue('READ_RESTRICTED');
} }
granteeUserIdControl?.updateValueAndValidity(); granteeUserIdControl?.updateValueAndValidity();
@ -187,9 +187,9 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit {
private buildScopes(): Scope[] { private buildScopes(): Scope[] {
switch (this.accessForm.get('accessLevel')?.value as AccessLevel) { switch (this.accessForm.get('accessLevel')?.value as AccessLevel) {
case 'CHANGE': case 'CREATE_READ_UPDATE_DELETE':
return [...SCOPES_OF_READ_ACCESS, ...SCOPES_OF_WRITE_ACCESS]; return [...SCOPES_OF_READ_ACCESS, ...SCOPES_OF_WRITE_ACCESS];
case 'VIEW': case 'READ':
return [...SCOPES_OF_READ_ACCESS]; return [...SCOPES_OF_READ_ACCESS];
default: default:
return [...SCOPES_OF_READ_RESTRICTED_ACCESS]; return [...SCOPES_OF_READ_RESTRICTED_ACCESS];
@ -241,12 +241,12 @@ export class GfCreateOrUpdateAccessDialogComponent implements OnInit {
return hasScope(scopesOfAccess, scope); return hasScope(scopesOfAccess, scope);
}) })
) { ) {
return 'CHANGE'; return 'CREATE_READ_UPDATE_DELETE';
} }
return hasScope(scopesOfAccess, scopes.portfolioReadValues) return hasScope(scopesOfAccess, scopes.portfolioReadValues)
? 'VIEW' ? 'READ'
: 'RESTRICTED_VIEW'; : 'READ_RESTRICTED';
} }
private loadHoldings() { 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-form-field appearance="outline" class="w-100">
<mat-label i18n>Permission</mat-label> <mat-label i18n>Permission</mat-label>
<mat-select formControlName="accessLevel"> <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') { @if (accessForm.get('type')?.value === 'PRIVATE') {
<mat-option i18n value="VIEW">View</mat-option> <mat-option i18n value="READ">View</mat-option>
<mat-option i18n value="CHANGE">View and change</mat-option> <mat-option i18n value="CREATE_READ_UPDATE_DELETE"
>View and manage</mat-option
>
} }
</mat-select> </mat-select>
</mat-form-field> </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; access?: Access;
} }
export type AccessLevel = 'CHANGE' | 'RESTRICTED_VIEW' | 'VIEW'; export type AccessLevel =
'CREATE_READ_UPDATE_DELETE' | 'READ' | 'READ_RESTRICTED';

Loading…
Cancel
Save