Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export const meetingSettingsDefaults: Record<string, any> = {
name: 'OpenSlides',
enable_idm_matching: false,
enable_anonymous: false,
users_pdf_wlan_encryption: 'WPA',
agenda_enable_numbering: true,
Expand Down
2 changes: 2 additions & 0 deletions client/src/app/domain/models/comittees/committee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class Committee extends BaseModel<Committee> {

public name!: string;
public description!: string;
public identity_key!: string;
public external_id!: string;
public parent_id!: Id;
public child_ids!: Id[];
Expand All @@ -33,6 +34,7 @@ export class Committee extends BaseModel<Committee> {
`name`,
`description`,
`external_id`,
`identity_key`,
`meeting_ids`,
`default_meeting_id`,
`user_ids`,
Expand Down
4 changes: 4 additions & 0 deletions client/src/app/domain/models/meetings/meeting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ export class Settings {
// SSO
public external_id!: string;

// IdM
public enable_idm_matching: boolean;

// Structure Level
public structure_level_ids: Id[]; // (structure_level/meeting_id)

Expand Down Expand Up @@ -319,6 +322,7 @@ export class Meeting extends BaseModel<Meeting> {
`template_for_organization_id`,
`enable_anonymous`,
`custom_translations`,
`enable_idm_matching`,
`conference_show`,
`conference_auto_connect`,
`conference_los_restriction`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export class CommitteeRepositoryService extends BaseRepository<ViewCommittee, Co
private getPartialCommitteePayload(committee: any): any {
const payload = {
description: committee.description,
identity_key: committee.identity_key,
organization_tag_ids: committee.organization_tag_ids === null ? [] : committee.organization_tag_ids,
manager_ids: committee.manager_ids,
forward_to_committee_ids:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ export const meetingSettings: SettingsGroup[] = fillInSettingsDefaults([
{
key: `external_id`,
label: _(`External ID`)
},
{
key: `enable_idm_matching`,
label: _(`Activate automatic Identity Mapping`),
type: `boolean`
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ <h1 class="mock-h2">
<mat-label>{{ 'Description' | translate }}</mat-label>
<input data-cy="committeeDescription" formControlName="description" matInput />
</mat-form-field>
<mat-form-field>
<mat-label>{{ 'Committee Key' | translate }}</mat-label>
<input data-cy="committeeKey" formControlName="identity_key" matInput />
</mat-form-field>
<mat-form-field>
<mat-label>{{ 'Tags' | translate }}</mat-label>
<os-repo-search-selector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export class CommitteeDetailEditComponent extends BaseComponent implements OnIni
const partialForm: any = {
name: [``, Validators.required],
description: [``],
identity_key: [``],
organization_tag_ids: [[]],
manager_ids: [[]],
forward_to_committee_ids: [[]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ <h1>
<div class="committee-description">
{{ committee.description }}
</div>
<!-- identity_key -->
@if (committee.identity_key) {
<div class="committee-description">
<div>
<b>{{ 'Committee Key' | translate }}</b>
</div>
<div>{{ committee.identity_key }}</div>
</div>
}
<!-- forward motions to -->
@if (committee.forward_to_committee_ids?.length > 0 && isOrgaAdmin()) {
<os-committee-meta-info icon="file_upload" [title]="'Forward motions to' | translate">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { _ } from '@ngx-translate/core';
export const committeeHeadersAndVerboseNames = {
name: _(`Title`),
description: _(`Description`),
identity_key: _(`Committee Key`),
organization_tags: _(`Tags`),
forward_to_committees: _(`Can forward motions to committee`),
managers: _(`Administrators`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,51 +195,118 @@ <h2>{{ 'Superadmin settings' | translate }}</h2>
</div>
</mat-card-content>
</mat-card>
<mat-card *osOmlPerms="OML.superadmin" class="os-card margin-bottom-60">
<mat-card class="os-card margin-bottom-60">
<mat-card-content>
<div class="saml-settings-form">
<h2>{{ 'Single Sign-On settings' | translate }}</h2>
<!-- sso enabled -->
<!-- IdM enabled -->
<section>
<mat-checkbox formControlName="saml_enabled">
{{ 'Enable SSO via SAML' | translate }}
</mat-checkbox>
</section>
<!-- SSO login button text -->
<!-- IdM login button text -->
<section>
<mat-form-field>
<mat-label>{{ 'Login button text' | translate }}</mat-label>
<input formControlName="saml_login_button_text" matInput />
</mat-form-field>
</section>
<!-- JSON source attribute -->
<section>
<mat-form-field subscriptSizing="dynamic">
<mat-label>{{ 'Attribute mapping (JSON)' | translate }}</mat-label>
<textarea formControlName="saml_attr_mapping" matInput [rows]="ssoConfigRows"></textarea>
<mat-hint>
{{
'Use JSON key:value structure (key = OpenSlides attribute name, value = IdP attribute
name).' | translate
}}
</mat-hint>
</mat-form-field>
<mat-card class="os-card os-mat-card-header">
<mat-card-header class="background-accent">
{{ 'Identity Mapper' | translate }}
</mat-card-header>
<form [formGroup]="mapperForm">
<mat-form-field>
<mat-label>{{ 'External group Title' | translate }}</mat-label>
<input formControlName="group_external_ids" matInput />
<mat-hint>Separate group ids with comma</mat-hint>
</mat-form-field>
<mat-form-field>
<mat-label>{{ 'Committee Admin Mapping Attribute' | translate }}</mat-label>
<input formControlName="idm_committee_management_key" matInput />
</mat-form-field>
<mat-form-field>
<mat-label>
{{ 'Organizationadmin or Accountadmin Mapping Attribute' | translate }}
</mat-label>
<input formControlName="idm_organization_management_key" matInput />
</mat-form-field>
<!-- Condition -->
<mat-card-header class="accent">
{{ 'Condition' | translate }}
</mat-card-header>
<form class="full-width condition-line" [formGroup]="conditionForm">
<!-- IDP Attribute-->
<mat-form-field>
<mat-label>{{ 'IDP-Attribute' | translate }}</mat-label>
<input formControlName="idm_field" matInput type="text" />
</mat-form-field>
<!-- -->
<mat-form-field>
<mat-label>{{ 'Regular Expression' | translate }}</mat-label>
<input formControlName="regex" matInput type="text" />
</mat-form-field>
</form>
<!-- Mapping -->
<mat-card-header class="accent">
{{ 'Mapper' | translate }}
</mat-card-header>
<form class="full-width mapping-line" [formGroup]="mappingForm">
<!-- IDP Attribute -->
<mat-form-field>
<mat-label>{{ 'IDP-Attribute' | translate }}</mat-label>
<input formControlName="idm_field" matInput type="text" />
</mat-form-field>
<!-- OpenSLides Attribute -->
<div>
<mat-form-field class="padding-top form-field">
<mat-label id="OS-attribute">
{{ 'OpenSlides Attribute' | translate }}
</mat-label>
<mat-select
aria-labelledby="OS-attribute"
formControlName="os_field"
required
>
@for (type of mappingChoices; track type) {
<mat-option [value]="type.key">
{{ type.name }}
</mat-option>
}
</mat-select>
</mat-form-field>
</div>
<!-- Attribute -->
<mat-form-field>
<mat-label>{{ 'Default atribute' | translate }}</mat-label>
<input formControlName="default_value" matInput type="text" />
</mat-form-field>
<div class="checkbox-row">
<mat-checkbox formControlName="allow_update">
{{ 'Allow update on login' | translate }}
</mat-checkbox>
<mat-checkbox class="sub-set" formControlName="override_default">
{{ 'Allow overrite on login' | translate }}
</mat-checkbox>
</div>
</form>
</form>
</mat-card>
</section>
<!-- SSO login button text -->
<section>
<mat-form-field>
<mat-label>{{ 'Metadata of Identity Provider (IdP)' | translate }}</mat-label>
<textarea formControlName="saml_metadata_idp" matInput wrap="hard" [rows]="6"></textarea>
</mat-form-field>
</section>
<!-- SSO login button text -->
<section>
<mat-form-field>
<mat-label>{{ 'Metadata of Service Provider (SP)' | translate }}</mat-label>
<textarea formControlName="saml_metadata_sp" matInput wrap="hard" [rows]="6"></textarea>
</mat-form-field>
</section>
<!-- SSO login button text -->
<section>
<mat-form-field>
<mat-label>{{ 'Private key of Service Provider (SP)' | translate }}</mat-label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,24 @@ mat-card mat-card-content h2 {
padding-bottom: 0px;
font-size: 12px;
}

.condition-line {
display: grid;
grid-template-columns: auto auto;
column-gap: 32px;
}

.mapping-line {
display: grid;
grid-template-columns: auto auto auto;
column-gap: 32px;
}

.checkbox-row {
display: flex;
flex-direction: column;
}

.sub-set {
margin-left: 15px;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChangeDetectionStrategy, Component, ElementRef, inject, signal, viewChild } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { availableTranslations } from '@app/domain/definitions/languages';
import { FormControl, FormGroup } from '@angular/forms';
import { Selectable } from '@app/domain/interfaces';
import { objectToFormattedString } from '@app/infrastructure/utils';
import { createEmailValidator } from '@app/infrastructure/utils/validators/email';
Expand All @@ -12,6 +12,25 @@ import { OperatorService } from '@app/site/services/operator.service';
import { TimeZoneService } from '@app/site/services/time-zone.service';
import { _ } from '@ngx-translate/core';

enum MappingItemType {
STRUCTURE_LEVEL = `structure_level`,
NUMBER = `number`,
VOTE_WEIGHT = `vote_weight`,
PRESENT = `present`,
COMMENT = `comment`
}

/**
* Determine type for Mapping Choices items
*/
const MappingTypeChoices = [
{ key: MappingItemType.STRUCTURE_LEVEL, name: _(`Structure level`) },
{ key: MappingItemType.NUMBER, name: _(`Participant number`) },
{ key: MappingItemType.VOTE_WEIGHT, name: _(`Vote weight`) },
{ key: MappingItemType.PRESENT, name: _(`Present Status`) },
{ key: MappingItemType.COMMENT, name: _(`Comment`) }
];

@Component({
selector: `os-organization-settings`,
templateUrl: `./organization-settings.component.html`,
Expand All @@ -23,7 +42,37 @@ export class OrganizationSettingsComponent extends BaseComponent {
public timeZoneInput = viewChild<ElementRef<HTMLInputElement>>('timeZoneInput');

public readonly pageTitle = _(`Settings`);
public readonly translations = availableTranslations;

public translations: Record<string, string> = {
start: `Start`,
end: `End`,
inter: `Between`
};

public mappingChoices = MappingTypeChoices;

public mapperForm = new FormGroup({
id: new FormControl<number | null>(null),
group_external_ids: new FormControl<string[]>([``]),
weight: new FormControl<number | null>(null),
idm_committee_management_key: new FormControl<string>(``),
idm_organization_management_key: new FormControl<string>(``)
});

public conditionForm = new FormGroup({
mapper_id: new FormControl<number | null>(null),
idm_field: new FormControl<string>(``),
regex: new FormControl<string>(``)
});

public mappingForm = new FormGroup({
mapper_id: new FormControl<number | null>(null),
idm_field: new FormControl<string>(``),
os_field: new FormControl<MappingItemType | null>(null),
default_value: new FormControl<string>(``),
allow_update: new FormControl<boolean>(false),
override_default: new FormControl<boolean>(false)
});

public orgaSettingsForm: UntypedFormGroup | null = null;

Expand Down Expand Up @@ -76,11 +125,10 @@ export class OrganizationSettingsComponent extends BaseComponent {

public onSubmit(): void {
const { ...payload }: any = this.orgaSettingsForm!.value;
if (this.operator.isSuperAdmin) {
payload.saml_attr_mapping = payload.saml_attr_mapping
? JSON.stringify(JSON.parse(payload.saml_attr_mapping as string))
: null;
}
payload.saml_attr_mapping = payload.saml_attr_mapping
? JSON.stringify(JSON.parse(payload.saml_attr_mapping as string))
: null;
console.log(payload);
for (const key of Object.keys(payload)) {
if (this.orgaSettingsForm.get(key).pristine) {
delete payload[key];
Expand Down Expand Up @@ -129,7 +177,17 @@ export class OrganizationSettingsComponent extends BaseComponent {
restrict_editing_same_level_committee_admins: [
this._currentOrgaSettings.restrict_editing_same_level_committee_admins ?? false
],
restrict_edit_forward_committees: [this._currentOrgaSettings.restrict_edit_forward_committees ?? false]
restrict_edit_forward_committees: [this._currentOrgaSettings.restrict_edit_forward_committees ?? false],
saml_login_button_text: [this._currentOrgaSettings.saml_login_button_text],
saml_attr_mapping: [
this._currentOrgaSettings.saml_attr_mapping &&
typeof this._currentOrgaSettings.saml_attr_mapping !== `string`
? JSON.stringify(this._currentOrgaSettings.saml_attr_mapping)
: this._currentOrgaSettings.saml_attr_mapping
],
saml_metadata_idp: [this._currentOrgaSettings.saml_metadata_idp],
saml_metadata_sp: [this._currentOrgaSettings.saml_metadata_sp],
saml_private_key: [this._currentOrgaSettings.saml_private_key]
};
if (this.operator.isSuperAdmin) {
rawSettingsForm = {
Expand All @@ -140,17 +198,7 @@ export class OrganizationSettingsComponent extends BaseComponent {
enable_chat: [this._currentOrgaSettings.enable_chat],
limit_of_meetings: [this._currentOrgaSettings.limit_of_meetings ?? 0],
limit_of_users: [this._currentOrgaSettings.limit_of_users ?? 0],
saml_enabled: [this._currentOrgaSettings.saml_enabled ?? false],
saml_login_button_text: [this._currentOrgaSettings.saml_login_button_text],
saml_attr_mapping: [
this._currentOrgaSettings.saml_attr_mapping &&
typeof this._currentOrgaSettings.saml_attr_mapping !== `string`
? JSON.stringify(this._currentOrgaSettings.saml_attr_mapping)
: this._currentOrgaSettings.saml_attr_mapping
],
saml_metadata_idp: [this._currentOrgaSettings.saml_metadata_idp],
saml_metadata_sp: [this._currentOrgaSettings.saml_metadata_sp],
saml_private_key: [this._currentOrgaSettings.saml_private_key]
saml_enabled: [this._currentOrgaSettings.saml_enabled ?? false]
};
}
} else {
Expand Down
Loading
Loading