Skip to content

Commit

Permalink
Hide group/external_id for non meeting admins (#4160)
Browse files Browse the repository at this point in the history
  • Loading branch information
reiterl authored Sep 23, 2024
1 parent 0db6a3a commit a68d5b0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ <h1 mat-dialog-title>
</mat-error>
}
</mat-form-field>
<mat-form-field>
<mat-label>{{ 'External ID' | translate }}</mat-label>
<input formControlName="external_id" matInput type="text" />
</mat-form-field>
@if (allowExternalId) {
<mat-form-field>
<mat-label>{{ 'External ID' | translate }}</mat-label>
<input formControlName="external_id" matInput type="text" />
</mat-form-field>
}
</form>
</mat-dialog-content>
<mat-dialog-actions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { isUniqueAmong } from 'src/app/infrastructure/utils/validators/is-unique
import { CanComponentDeactivate } from 'src/app/site/guards/watch-for-changes.guard';
import { BaseMeetingComponent } from 'src/app/site/pages/meetings/base/base-meeting.component';
import { ViewGroup } from 'src/app/site/pages/meetings/pages/participants';
import { OperatorService } from 'src/app/site/services/operator.service';
import { PromptService } from 'src/app/ui/modules/prompt-dialog';

import { GroupControllerService } from '../../services';
Expand Down Expand Up @@ -80,6 +81,7 @@ export class GroupListComponent extends BaseMeetingComponent implements OnInit,
private dialog: MatDialog,
private repo: GroupControllerService,
private promptService: PromptService,
private operator: OperatorService,
private formBuilder: UntypedFormBuilder
) {
super();
Expand Down Expand Up @@ -113,7 +115,7 @@ export class GroupListComponent extends BaseMeetingComponent implements OnInit,
const name = this.selectedGroup ? this.selectedGroup.name : ``;
const external_id = this.selectedGroup?.external_id ?? ``;

this.groupForm = this.formBuilder.group({
const formConfig = {
name: [
name,
[
Expand All @@ -126,7 +128,12 @@ export class GroupListComponent extends BaseMeetingComponent implements OnInit,
]
],
external_id: [external_id]
});
};
if (!this.allowExternalId) {
delete formConfig.external_id;
}

this.groupForm = this.formBuilder.group(formConfig);

this.dialogRef = this.dialog.open(this.groupEditDialog!, infoDialogSettings);

Expand Down Expand Up @@ -277,4 +284,11 @@ export class GroupListComponent extends BaseMeetingComponent implements OnInit,
}
return true;
}

/**
* Function to allow to edit the external_id
*/
public get allowExternalId(): boolean {
return this.operator.isMeetingAdmin || this.operator.isSuperAdmin;
}
}

0 comments on commit a68d5b0

Please sign in to comment.