Change "change your own delegation" option to account button - #6141
Change "change your own delegation" option to account button#6141Borreg0 wants to merge 10 commits into
Conversation
bspekker
left a comment
There was a problem hiding this comment.
- Changing the own delegation doesn't work anymore for users with only "can change own delegation" permission:
- The dialogue I can open from the user menu looks good, but the dialogue you can open in the participant list as admins by clicking on the column with groups, numbers, structure levels etc, should still be the old previous dialogue:
The column I mean:
The dialogue that should still be available as is for everyone with more admin permissions than just "can change own delegation":
| <mat-icon>edit</mat-icon> | ||
| <span>{{ 'Change your delegation' | translate }}</span> | ||
| </button> | ||
|
|
There was a problem hiding this comment.
- remove also this line
- hide the three dot menu, it's currently only an empty field
| return this.activeMeetingIdService.meetingId; | ||
| } | ||
|
|
||
| public get activeMeetingSetting(): boolean { |
There was a problem hiding this comment.
rename to sth more specific or make function more generic with forwarded setting
put the subscription in a setter or the subscription in the constructor
| stringForUserPresent = this.translate.instant(`Your account is not in this meeting.`); | ||
| } | ||
| return this.user.short_name + ': ' + stringForUserPresent; | ||
| return stringForUserPresent.replace(`{}`, this.user.short_name); |
There was a problem hiding this comment.
| return stringForUserPresent.replace(`{}`, this.user.short_name); | |
| return this.user.short_name + ': ' + stringForUserPresent; |
| } | ||
| } | ||
| </div> | ||
| @if (activeMeetingSetting && canEditOwnDelegation(user)) { |
There was a problem hiding this comment.
add hasActiveMeeting as first check
| 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; | ||
| } |
There was a problem hiding this comment.
this is a new place for this option
At this new place one you are be the user so the check in 257 is always true
You need to check
this.operator.hasPerms(Permission.userCanEditOwnDelegation) and if the operator is in the meeting
(Admins (including superadmin/etc.) automatically have this permission)
| if ( | ||
| !( | ||
| user.id === operator.operatorId && | ||
| areGroupsDiminished(operator.user.group_ids(), result.group_ids, activeMeeting) |
There was a problem hiding this comment.
why not use user.groups()?
if that is possible you can transmit the operator.operatorId directly and do not need to give the whole operator
also the operator is loaded in the service you do not need to transmit it at all
| this.router.navigate([userId, `edit`], { relativeTo: this.route }); | ||
| } | ||
| } | ||
| export { areGroupsDiminished }; |
There was a problem hiding this comment.
remove bc it's unused
and such export should also be below the imports but above the main component/director/service
| @@ -0,0 +1,3 @@ | |||
| .margin { | |||
| public constructor( | ||
| @Inject(MAT_DIALOG_DATA) public readonly infoDialog: InfoDialog, | ||
| private participantRepo: ParticipantControllerService, | ||
| private userSortService: ParticipantListSortService, | ||
| private groupRepo: GroupControllerService, | ||
| private structureLevelRepo: StructureLevelControllerService, | ||
| private meetingSettings: MeetingSettingsService, | ||
| private operator: OperatorService | ||
| protected participantRepo: ParticipantControllerService, | ||
| protected userSortService: ParticipantListSortService, | ||
| protected groupRepo: GroupControllerService, | ||
| protected structureLevelRepo: StructureLevelRepositoryService, | ||
| protected activeMeetingIdService: ActiveMeetingIdService, | ||
| protected meetingSettings: MeetingSettingsService, | ||
| protected operator: OperatorService, | ||
| protected userRepo: UserRepositoryService = inject(UserRepositoryService) | ||
| ) { |
There was a problem hiding this comment.
use inject outside of constructor
and change back to private if possible
| protected structureLevelConfig: SubscriptionConfig<ViewStructureLevel>; | ||
| protected groupsSubscriptionConfig: SubscriptionConfig<ViewGroup>; | ||
|
|
||
| protected setting: SettingsInput = {} as SettingsInput; |
There was a problem hiding this comment.
remove setting
as far as I can see it's now used anywhere
closes #5967