diff --git a/client/src/app/site/modules/global-headbar/components/account-button/account-button.component.html b/client/src/app/site/modules/global-headbar/components/account-button/account-button.component.html index 378314685a..3668d5ec33 100644 --- a/client/src/app/site/modules/global-headbar/components/account-button/account-button.component.html +++ b/client/src/app/site/modules/global-headbar/components/account-button/account-button.component.html @@ -94,6 +94,12 @@ } } + @if (activeMeetingSetting && canEditOwnDelegation(user)) { + + } } diff --git a/client/src/app/site/modules/global-headbar/components/account-button/account-button.component.ts b/client/src/app/site/modules/global-headbar/components/account-button/account-button.component.ts index e675251346..cdfb321251 100644 --- a/client/src/app/site/modules/global-headbar/components/account-button/account-button.component.ts +++ b/client/src/app/site/modules/global-headbar/components/account-button/account-button.component.ts @@ -7,8 +7,10 @@ import { Observable, Subscription } from 'rxjs'; import { Id } from 'src/app/domain/definitions/key-types'; import { allAvailableTranslations, availableTranslations } from 'src/app/domain/definitions/languages'; import { getOmlVerboseName } from 'src/app/domain/definitions/organization-permission'; +import { Permission } from 'src/app/domain/definitions/permission'; import { largeDialogSettings } from 'src/app/infrastructure/utils/dialog-settings'; import { mediumDialogSettings } from 'src/app/infrastructure/utils/dialog-settings'; +import { ParticipantListInfoDialogService } from 'src/app/site/pages/meetings/pages/participants/pages/participant-list/modules/participant-list-info-dialog'; import { ActiveMeetingIdService } from 'src/app/site/pages/meetings/services/active-meeting-id.service'; import { MeetingSettingsService } from 'src/app/site/pages/meetings/services/meeting-settings.service'; import { ViewUser } from 'src/app/site/pages/meetings/view-models/view-user'; @@ -70,6 +72,7 @@ export class AccountButtonComponent extends BaseUiComponent implements OnInit { public username = ``; public isLoggedIn = false; + private _voteDelegationEnabled = false; public show1337 = -20; @@ -77,6 +80,13 @@ export class AccountButtonComponent extends BaseUiComponent implements OnInit { return this.activeMeetingIdService.meetingId; } + public get activeMeetingSetting(): boolean { + this.meetingSettingsService + .get(`users_enable_vote_delegations`) + .subscribe(enabled => (this._voteDelegationEnabled = enabled)); + return this._voteDelegationEnabled; + } + private _isAllowedSelfSetPresent = false; private _languageTrigger: MatMenuTrigger | undefined = undefined; private clickCounter = 0; @@ -88,6 +98,7 @@ export class AccountButtonComponent extends BaseUiComponent implements OnInit { private userRepo: UserControllerService, private authService: AuthService, private dialog: MatDialog, + private participantListDialog: ParticipantListInfoDialogService, private router: Router, private theme: ThemeService, private meetingSettingsService: MeetingSettingsService, @@ -226,4 +237,33 @@ export class AccountButtonComponent extends BaseUiComponent implements OnInit { } return stringForUserPresent.replace(`{}`, this.user.short_name); } + + public canEditOwnDelegation(user: ViewUser): boolean { + if ( + this.operator.hasPerms(Permission.userCanEditOwnDelegation) && + !this.operator.hasPerms(Permission.userCanManage) && + !this.operator.hasPerms(Permission.userCanUpdate) + ) { + return this.operator.operatorId === user.id; + } else if ( + this.operator.hasPerms(Permission.userCanManage) || + this.operator.hasPerms(Permission.userCanUpdate) + ) { + return true; + } else { + return false; + } + } + + public async openDialogEditInfo(user: ViewUser): Promise { + await this.participantListDialog.open({ + user, + id: user.id, + name: user.getName(), + number: user.number(), + structure_level_ids: this.user.structure_level_ids(), + vote_delegations_from_ids: this.user.vote_delegations_from_meeting_user_ids(), + vote_delegated_to_id: this.user.vote_delegated_to_meeting_user_id() + }); + } } diff --git a/client/src/app/site/pages/meetings/pages/participants/pages/participant-list/components/participant-list/participant-list.component.html b/client/src/app/site/pages/meetings/pages/participants/pages/participant-list/components/participant-list/participant-list.component.html index 34658da893..62eea91151 100644 --- a/client/src/app/site/pages/meetings/pages/participants/pages/participant-list/components/participant-list/participant-list.component.html +++ b/client/src/app/site/pages/meetings/pages/participants/pages/participant-list/components/participant-list/participant-list.component.html @@ -341,14 +341,7 @@

Participants

record_voice_over Contributions - +