Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new delegation settings #3593

Merged
merged 4 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/src/app/domain/models/meetings/meeting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ export class Settings {
public users_email_replyto!: string;
public users_email_subject!: string;
public users_email_body!: string;
public users_forbid_delegator_in_list_of_speakers!: string;
public users_forbid_delegator_as_submitter!: string;
public users_forbid_delegator_as_supporter!: string;
public users_forbid_delegator_in_list_of_speakers!: boolean;
public users_forbid_delegator_as_submitter!: boolean;
public users_forbid_delegator_as_supporter!: boolean;

// Assignments
public assignments_export_title!: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,7 @@
<span *ngIf="!canAddDueToPresence" translate>You have to be present to add yourself.</span>
</div>

<div
class="add-self-buttons"
*osPerms="
permission.listOfSpeakersCanBeSpeaker;
delegationSettingAlternative: [
'users_forbid_delegator_in_list_of_speakers',
permission.listOfSpeakersCanManage
]
"
>
<div class="add-self-buttons" *ngIf="addSelf && !isOpInWaitlist(true)">
<!-- Add me and remove me if OP has correct permission -->

<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ export class ListOfSpeakersContentComponent extends BaseMeetingComponent impleme
return this.pointOfOrderEnabled && this.canAddDueToPresence;
}

public get addSelf(): boolean {
return (
this.permission.listOfSpeakersCanBeSpeaker && !(this.voteDelegationEnabled && this.forbidDelegatorToAddSelf)
);
}

public get showSpeakerNoteForEveryoneObservable(): Observable<boolean> {
return this.meetingSettingsService.get(`list_of_speakers_speaker_note_for_everyone`);
}
Expand Down Expand Up @@ -140,6 +146,10 @@ export class ListOfSpeakersContentComponent extends BaseMeetingComponent impleme

public pointOfOrderEnabled = false;

private voteDelegationEnabled = false;

private forbidDelegatorToAddSelf = false;

public structureLevelCountdownEnabled = false;

@Output()
Expand Down Expand Up @@ -521,6 +531,12 @@ export class ListOfSpeakersContentComponent extends BaseMeetingComponent impleme
}),
this.meetingSettingsService.get(`list_of_speakers_default_structure_level_time`).subscribe(time => {
this.structureLevelCountdownEnabled = time > 0;
}),
this.meetingSettingsService.get(`users_enable_vote_delegations`).subscribe(enabled => {
this.voteDelegationEnabled = enabled;
}),
this.meetingSettingsService.get(`users_forbid_delegator_in_list_of_speakers`).subscribe(enabled => {
this.forbidDelegatorToAddSelf = enabled;
})
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export class MotionPermissionService {
private _amendmentEnabled = false;
private _amendmentOfAmendmentEnabled = false;

private _delegationEnabled = false;
private _forbidDelegatorCreateMotions = false;
private _forbidDelegatorSupportMotions = false;

public constructor(private operator: OperatorService, private meetingSettingsService: MeetingSettingsService) {
// load config variables
this.meetingSettingsService
Expand All @@ -25,6 +29,15 @@ export class MotionPermissionService {
this.meetingSettingsService
.get(`motions_amendments_of_amendments`)
.subscribe(enabled => (this._amendmentOfAmendmentEnabled = enabled));
this.meetingSettingsService.get(`users_enable_vote_delegations`).subscribe(enabled => {
this._delegationEnabled = enabled;
});
this.meetingSettingsService.get(`users_forbid_delegator_as_submitter`).subscribe(enabled => {
this._forbidDelegatorCreateMotions = enabled;
});
this.meetingSettingsService.get(`users_forbid_delegator_as_supporter`).subscribe(enabled => {
this._forbidDelegatorSupportMotions = enabled;
});
}

/**
Expand Down Expand Up @@ -63,7 +76,7 @@ export class MotionPermissionService {
switch (action) {
case `create`: {
return this.operator.hasPerms(
this.operator.isAllowedWithDelegation(`users_forbid_delegator_as_submitter`)
!(this._delegationEnabled && this._forbidDelegatorCreateMotions)
? Permission.motionCanCreate
: Permission.motionCanManage
);
Expand All @@ -74,7 +87,7 @@ export class MotionPermissionService {
}
return (
this.operator.hasPerms(
this.operator.isAllowedWithDelegation(`users_forbid_delegator_as_supporter`)
!(this._delegationEnabled && this._forbidDelegatorSupportMotions)
? Permission.motionCanSupport
: Permission.motionCanManage
) &&
Expand All @@ -91,7 +104,7 @@ export class MotionPermissionService {
}
return (
this.operator.hasPerms(
this.operator.isAllowedWithDelegation(`users_forbid_delegator_as_supporter`)
!(this._delegationEnabled && this._forbidDelegatorSupportMotions)
? Permission.motionCanSupport
: Permission.motionCanManage
) &&
Expand Down Expand Up @@ -172,7 +185,7 @@ export class MotionPermissionService {
}
return (
this.operator.hasPerms(
this.operator.isAllowedWithDelegation(`users_forbid_delegator_as_submitter`)
!(this._delegationEnabled && this._forbidDelegatorCreateMotions)
? Permission.motionCanCreateAmendments
: Permission.motionCanManage
) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -911,17 +911,23 @@ export const meetingSettings: SettingsGroup[] = fillInSettingsDefaults([
{
key: `users_forbid_delegator_in_list_of_speakers`,
label: _(`Restrict delegation principals from adding themselves to the list of speakers`),
type: `boolean`
type: `boolean`,
indentation: 1,
disable: settings => !settings.users_enable_vote_delegations
},
{
key: `users_forbid_delegator_as_submitter`,
label: _(`Restrict delegation principals from creating motions/amendments`),
type: `boolean`
type: `boolean`,
indentation: 1,
disable: settings => !settings.users_enable_vote_delegations
},
{
key: `users_forbid_delegator_as_supporter`,
label: _(`Restrict delegation principals from supporting motions`),
type: `boolean`
type: `boolean`,
indentation: 1,
disable: settings => !settings.users_enable_vote_delegations
}
]
},
Expand Down
Loading