Skip to content

Commit

Permalink
Add public access orga setting (#4229)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel authored and openslides-automation committed Oct 9, 2024
1 parent 4790efe commit 7634588
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 17 deletions.
2 changes: 1 addition & 1 deletion client/src/app/domain/models/meetings/meeting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,9 @@ export class Meeting extends BaseModel<Meeting> {
`motions_enable_reason_on_projector`,
`motions_enable_sidebox_on_projector`,
`motions_enable_recommendation_on_projector`,
`motions_hide_metadata_background`,
`motions_show_referring_motions`,
`motions_show_sequential_number`,
`motions_hide_metadata_background`,
`motions_recommendations_by`,
`motions_block_slide_columns`,
`motions_recommendation_text_mode`,
Expand Down
2 changes: 2 additions & 0 deletions client/src/app/domain/models/organizations/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class OrganizationSetting {
public limit_of_users!: number;
public default_language!: string;
public require_duplicate_from!: boolean;
public enable_anonymous!: boolean;

public users_email_sender!: string; // default: OpenSlides
public users_email_subject!: string; // default: OpenSlides access data
Expand Down Expand Up @@ -73,6 +74,7 @@ export class Organization extends BaseModel<Organization> {
`limit_of_users`,
`default_language`,
`require_duplicate_from`,
`enable_anonymous`,
`saml_enabled`,
`saml_login_button_text`,
`saml_attr_mapping`,
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/domain/models/users/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export class Group extends BaseModel<Group> {
`weight`,
`meeting_user_ids`,
`default_group_for_meeting_id`,
`anonymous_group_for_meeting_id`,
`admin_group_for_meeting_id`,
`anonymous_group_for_meeting_id`,
`meeting_mediafile_access_group_ids`,
`meeting_mediafile_inherited_access_group_ids`,
`read_comment_section_ids`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { getUnixTime } from 'date-fns';
import { Action } from 'src/app/gateways/actions';
import { OrganizationSettingsService } from 'src/app/site/pages/organization/services/organization-settings.service';

import { Id } from '../../domain/definitions/key-types';
import { Identifiable } from '../../domain/interfaces/identifiable';
Expand Down Expand Up @@ -42,7 +43,8 @@ export interface MeetingUserModifiedFields {
export class MeetingRepositoryService extends BaseRepository<ViewMeeting, Meeting> {
public constructor(
repositoryServiceCollector: RepositoryServiceCollectorService,
private meetingSettingsDefinitionProvider: MeetingSettingsDefinitionService
private meetingSettingsDefinitionProvider: MeetingSettingsDefinitionService,
private orgaSettingsService: OrganizationSettingsService
) {
super(repositoryServiceCollector, Meeting);
}
Expand Down Expand Up @@ -257,6 +259,8 @@ export class MeetingRepositoryService extends BaseRepository<ViewMeeting, Meetin
): {
title: string;
} => this.getProjectorTitle(viewModel, projection);
viewModel.publicAccessPossible = (): boolean =>
model.enable_anonymous && this.orgaSettingsService.instant(`enable_anonymous`);
return viewModel;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export class OrganizationRepositoryService extends BaseRepository<ViewOrganizati
`default_language`,
`saml_metadata_idp`,
`saml_metadata_sp`,
`saml_private_key`
`saml_private_key`,
`enable_anonymous`
);
return {
...super.getFieldsets(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,15 @@ export class LoginMaskComponent extends BaseMeetingComponent implements OnInit,
this.route.queryParams.pipe(filter(params => params[`checkBrowser`])).subscribe(params => {
this.checkBrowser = params[`checkBrowser`] === `true`;
});
this.route.params.subscribe(params => {
if (params[`meetingId`]) {
this.loadMeeting(params[`meetingId`]);
} else {
this.loadActiveMeetings();
}
});
if (this.orgaSettings.instant(`enable_anonymous`)) {
this.route.params.subscribe(params => {
if (params[`meetingId`]) {
this.loadMeeting(params[`meetingId`]);
} else {
this.loadActiveMeetings();
}
});
}

if (this.checkBrowser) {
this.checkDevice();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ export class ViewMeeting extends BaseHasMeetingUsersViewModel<Meeting> {

protected _collection = Meeting.COLLECTION;

public publicAccessPossible!: () => boolean;

public getUrl(): string {
return `/${this.id}/`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[ngClass]="{ 'background-accent': meeting.isActive, 'background-dark-brighter': meeting.isArchived }"
>
<mat-card-title class="break-word">
@if (meeting.enable_anonymous) {
@if (meeting.publicAccessPossible()) {
<div class="template-indicator">
<mat-icon [matTooltip]="'Public' | translate">public</mat-icon>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ <h2>{{ 'Calendar' | translate }}</h2>
@if (meeting.isArchived) {
<mat-icon matTooltip="{{ 'This meeting is archived' | translate }}">archive</mat-icon>
}
@if (meeting.enable_anonymous && !operator.isAnonymous) {
@if (meeting.publicAccessPossible() && !operator.isAnonymous) {
<mat-icon matTooltip="{{ 'This meeting is public' | translate }}">public</mat-icon>
}
@if (meeting.committee_id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class DashboardComponent extends BaseComponent {
meeting =>
this.operator.isInMeeting(meeting.id) ||
this.operator.isSuperAdmin ||
(meeting.enable_anonymous && this.operator.isAnonymous)
(meeting.publicAccessPossible() && this.operator.isAnonymous)
);
const currentDate = new Date();
currentDate.setHours(0, 0, 0, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h2>{{ 'Meetings' | translate }}</h2>
}

<!--- Is public -->
@if (meeting.enable_anonymous) {
@if (meeting.publicAccessPossible()) {
<span class="icon-prefix">
<mat-icon [matTooltip]="'Public' | translate">public</mat-icon>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ <h2>{{ 'General' | translate }}</h2>
}
</mat-select>
</mat-form-field>
<!-- require_duplicate_from -->
<section>
<mat-checkbox formControlName="require_duplicate_from">
{{ 'Public template required for creating new meeting' | translate }}
Expand Down Expand Up @@ -105,6 +104,13 @@ <h2>{{ 'Superadmin settings' | translate }}</h2>
{{ 'Enable chat globally' | translate }}
</mat-checkbox>
</section>

<section>
<mat-checkbox formControlName="enable_anonymous">
{{ 'Meetings can be public' | translate }}
</mat-checkbox>
</section>

<section>
<mat-form-field subscriptSizing="dynamic">
<mat-label>{{ 'Limit of active meetings' | translate }}</mat-label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ export class OrganizationSettingsComponent extends BaseComponent {
users_email_sender: [this._currentOrgaSettings.users_email_sender],
users_email_subject: [this._currentOrgaSettings.users_email_subject],
default_language: [this._currentOrgaSettings.default_language],
require_duplicate_from: [this._currentOrgaSettings.require_duplicate_from ?? false]
require_duplicate_from: [this._currentOrgaSettings.require_duplicate_from ?? false],
enable_anonymous: [this._currentOrgaSettings.enable_anonymous ?? false]
};
if (this.operator.isSuperAdmin) {
rawSettingsForm = {
Expand Down

0 comments on commit 7634588

Please sign in to comment.