Merge pull request #4223 from FinnStutzenstein/default-group-nav

Fixed operator respecting the default group
This commit is contained in:
Sean 2019-01-31 12:07:56 +01:00 committed by GitHub
commit 8f4dddf495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 40 additions and 8 deletions

View File

@ -174,7 +174,8 @@ export class OperatorService extends OpenSlidesComponent {
*/
private updatePermissions(): void {
this.permissions = [];
if (!this.user) {
// Anonymous or users in the default group.
if (!this.user || this.user.groups_id.length === 0) {
const defaultGroup = this.DS.get<Group>('users/group', 1);
if (defaultGroup && defaultGroup.permissions instanceof Array) {
this.permissions = defaultGroup.permissions;

View File

@ -1,5 +1,6 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { Displayable } from 'app/shared/models/base/displayable';
import { Identifiable } from 'app/shared/models/base/identifiable';

View File

@ -1,5 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { LoginDataService } from '../../../core/services/login-data.service';
import { environment } from 'environments/environment';
import { HttpService } from '../../../core/services/http.service';

View File

@ -1,4 +1,5 @@
import { Component, OnInit, Input } from '@angular/core';
import { MediaManageService } from '../../../site/mediafiles/services/media-manage.service';
/**

View File

@ -1,5 +1,6 @@
import { Input, Output, Component, ViewChild, EventEmitter } from '@angular/core';
import { MatBottomSheet } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';
import { BaseViewModel } from '../../../site/base/base-view-model';

View File

@ -1,7 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { LoginDataService } from '../../../core/services/login-data.service';
import { TranslateService } from '@ngx-translate/core';
import { LoginDataService } from '../../../core/services/login-data.service';
/**
* Shared component to hold the content of the Privacy Policy.
* Used in login and site container.

View File

@ -1,5 +1,6 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
import { ProjectorElementBuildDeskriptor } from 'app/site/base/projectable';
import { DataStoreService } from 'app/core/services/data-store.service';
import { Projector, IdentifiableProjectorElement } from 'app/shared/models/core/projector';

View File

@ -1,4 +1,5 @@
import { Component, OnInit, Input } from '@angular/core';
import { Projectable, ProjectorElementBuildDeskriptor } from 'app/site/base/projectable';
import { ProjectionDialogService } from 'app/core/services/projection-dialog.service';
import { ProjectorService } from '../../../core/services/projector.service';

View File

@ -1,9 +1,11 @@
import { Component, OnInit, Input, ViewChild, OnDestroy } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { Subject, ReplaySubject, BehaviorSubject, Subscription } from 'rxjs';
import { MatSelect } from '@angular/material';
import { Subject, ReplaySubject, BehaviorSubject, Subscription } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { TranslateService } from '@ngx-translate/core';
import { Selectable } from '../selectable';
/**

View File

@ -1,9 +1,11 @@
import { Component, OnInit, Input, Output, EventEmitter, ContentChild, TemplateRef, OnDestroy } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
import { TranslateService } from '@ngx-translate/core';
import { Observable, Subscription } from 'rxjs';
import { Selectable } from '../selectable';
import { EmptySelectable } from '../empty-selectable';
import { Observable, Subscription } from 'rxjs';
/**
* Reusable Sorting List

View File

@ -1,4 +1,6 @@
import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core';
import { Directive, Input, TemplateRef, ViewContainerRef, OnDestroy, OnInit } from '@angular/core';
import { Subscription } from 'rxjs';
import { OperatorService, Permission } from 'app/core/services/operator.service';
import { OpenSlidesComponent } from 'app/openslides.component';
@ -13,7 +15,7 @@ import { OpenSlidesComponent } from 'app/openslides.component';
@Directive({
selector: '[osPerms]'
})
export class PermsDirective extends OpenSlidesComponent {
export class PermsDirective extends OpenSlidesComponent implements OnInit, OnDestroy {
/**
* Holds the required permissions the access a feature
*/
@ -46,6 +48,8 @@ export class PermsDirective extends OpenSlidesComponent {
*/
private complement: boolean;
private operatorSubscription: Subscription | null;
/**
* Constructs the directive once. Observes the operator for it's groups so the
* directive can perform changes dynamically
@ -60,13 +64,21 @@ export class PermsDirective extends OpenSlidesComponent {
private operator: OperatorService
) {
super();
}
public ngOnInit(): void {
// observe groups of operator, so the directive can actively react to changes
this.operator.getObservable().subscribe(content => {
this.operatorSubscription = this.operator.getObservable().subscribe(() => {
this.updateView();
});
}
public ngOnDestroy(): void {
if (this.operatorSubscription) {
this.operatorSubscription.unsubscribe();
}
}
/**
* Comes directly from the view.
* The value defines the requires permissions as an array or a single permission.

View File

@ -1,4 +1,5 @@
import { OnInit, ElementRef, Directive, Input } from '@angular/core';
import { ResizeSensor } from 'css-element-queries';
import { Subject } from 'rxjs';

View File

@ -23,6 +23,7 @@
placeholder="{{ 'New password' | translate }}"
/>
<mat-icon
class="pointer"
matSuffix
mat-icon-button
(click)="admin_generatePassword()">

View File

@ -1,3 +1,7 @@
mat-form-field {
width: 100%;
}
.pointer {
cursor: pointer;
}