diff --git a/client/src/app/site/polls/components/poll-progress/poll-progress.component.html b/client/src/app/site/polls/components/poll-progress/poll-progress.component.html index cffac2db8..8a9faa373 100644 --- a/client/src/app/site/polls/components/poll-progress/poll-progress.component.html +++ b/client/src/app/site/polls/components/poll-progress/poll-progress.component.html @@ -1,4 +1,4 @@ -
+
{{ votescast }} / {{ max }}
diff --git a/client/src/app/site/polls/components/poll-progress/poll-progress.component.ts b/client/src/app/site/polls/components/poll-progress/poll-progress.component.ts index 000370ab1..7a1742aa7 100644 --- a/client/src/app/site/polls/components/poll-progress/poll-progress.component.ts +++ b/client/src/app/site/polls/components/poll-progress/poll-progress.component.ts @@ -5,9 +5,10 @@ import { Title } from '@angular/platform-browser'; import { TranslateService } from '@ngx-translate/core'; import { map } from 'rxjs/operators'; +import { OperatorService } from 'app/core/core-services/operator.service'; import { UserRepositoryService } from 'app/core/repositories/users/user-repository.service'; import { BaseViewComponentDirective } from 'app/site/base/base-view'; -import { ViewBasePoll } from 'app/site/polls/models/view-base-poll'; +import { PollClassType, ViewBasePoll } from 'app/site/polls/models/view-base-poll'; @Component({ selector: 'os-poll-progress', @@ -23,11 +24,22 @@ export class PollProgressComponent extends BaseViewComponentDirective implements return this.poll?.votescast || 0; } + public get canSeeProgressBar(): boolean { + let canManage = false; + if (this.poll?.pollClassType === PollClassType.Motion) { + canManage = this.operator.hasPerms(this.permission.motionsCanManagePolls); + } else if (this.poll?.pollClassType === PollClassType.Assignment) { + canManage = this.operator.hasPerms(this.permission.assignmentsCanManage); + } + return canManage && this.operator.hasPerms(this.permission.usersCanSeeName); + } + public constructor( title: Title, protected translate: TranslateService, snackbar: MatSnackBar, - private userRepo: UserRepositoryService + private userRepo: UserRepositoryService, + private operator: OperatorService ) { super(title, translate, snackbar); } @@ -41,12 +53,14 @@ export class PollProgressComponent extends BaseViewComponentDirective implements map(users => /** * Filter the users who would be able to vote: - * They are present or have their right to vote delegated + * They are present and don't have their vote right delegated + * or the have their vote delegated to a user who is present. * They are in one of the voting groups */ users.filter( user => - (user.is_present || user.isVoteRightDelegated) && + ((user.is_present && !user.isVoteRightDelegated) || + user.voteDelegatedTo?.is_present) && this.poll.groups_id.intersect(user.groups_id).length ) ) diff --git a/server/openslides/users/access_permissions.py b/server/openslides/users/access_permissions.py index 2f87df3af..bf00e9688 100644 --- a/server/openslides/users/access_permissions.py +++ b/server/openslides/users/access_permissions.py @@ -63,16 +63,27 @@ class UserAccessPermissions(BaseAccessPermissions): # Check user permissions. if await async_has_perm(user_id, "users.can_see_name"): + whitelist_operator = None if await async_has_perm(user_id, "users.can_see_extra_data"): if await async_has_perm(user_id, "users.can_manage"): - data = [filtered_data(full, all_data_fields) for full in full_data] + whitelist = all_data_fields else: - data = [filtered_data(full, many_data_fields) for full in full_data] + whitelist = many_data_fields else: - data = [ - filtered_data(full, little_data_fields, own_data_fields) - for full in full_data - ] + whitelist = little_data_fields + whitelist_operator = own_data_fields + + # for managing {motion, assignment} polls the users needs to know + # the vote delegation structure. + if await async_has_perm( + user_id, "motion.can_manage_polls" + ) or await async_has_perm(user_id, "assignments.can_manage"): + whitelist.add("vote_delegated_to_id") + whitelist.add("vote_delegated_from_users_id") + + data = [ + filtered_data(full, whitelist, whitelist_operator) for full in full_data + ] else: # Build a list of users, that can be seen without any permissions (with little fields).