Fixed operator respecting the default group
This commit is contained in:
parent
eb21ae0136
commit
a53e0f27e6
@ -174,7 +174,8 @@ export class OperatorService extends OpenSlidesComponent {
|
|||||||
*/
|
*/
|
||||||
private updatePermissions(): void {
|
private updatePermissions(): void {
|
||||||
this.permissions = [];
|
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);
|
const defaultGroup = this.DS.get<Group>('users/group', 1);
|
||||||
if (defaultGroup && defaultGroup.permissions instanceof Array) {
|
if (defaultGroup && defaultGroup.permissions instanceof Array) {
|
||||||
this.permissions = defaultGroup.permissions;
|
this.permissions = defaultGroup.permissions;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
|
||||||
|
|
||||||
import { Displayable } from 'app/shared/models/base/displayable';
|
import { Displayable } from 'app/shared/models/base/displayable';
|
||||||
import { Identifiable } from 'app/shared/models/base/identifiable';
|
import { Identifiable } from 'app/shared/models/base/identifiable';
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { LoginDataService } from '../../../core/services/login-data.service';
|
import { LoginDataService } from '../../../core/services/login-data.service';
|
||||||
import { environment } from 'environments/environment';
|
import { environment } from 'environments/environment';
|
||||||
import { HttpService } from '../../../core/services/http.service';
|
import { HttpService } from '../../../core/services/http.service';
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
|
|
||||||
import { MediaManageService } from '../../../site/mediafiles/services/media-manage.service';
|
import { MediaManageService } from '../../../site/mediafiles/services/media-manage.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Input, Output, Component, ViewChild, EventEmitter } from '@angular/core';
|
import { Input, Output, Component, ViewChild, EventEmitter } from '@angular/core';
|
||||||
import { MatBottomSheet } from '@angular/material';
|
import { MatBottomSheet } from '@angular/material';
|
||||||
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { BaseViewModel } from '../../../site/base/base-view-model';
|
import { BaseViewModel } from '../../../site/base/base-view-model';
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { LoginDataService } from '../../../core/services/login-data.service';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
import { LoginDataService } from '../../../core/services/login-data.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared component to hold the content of the Privacy Policy.
|
* Shared component to hold the content of the Privacy Policy.
|
||||||
* Used in login and site container.
|
* Used in login and site container.
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
|
||||||
|
|
||||||
import { ProjectorElementBuildDeskriptor } from 'app/site/base/projectable';
|
import { ProjectorElementBuildDeskriptor } from 'app/site/base/projectable';
|
||||||
import { DataStoreService } from 'app/core/services/data-store.service';
|
import { DataStoreService } from 'app/core/services/data-store.service';
|
||||||
import { Projector, IdentifiableProjectorElement } from 'app/shared/models/core/projector';
|
import { Projector, IdentifiableProjectorElement } from 'app/shared/models/core/projector';
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
|
|
||||||
import { Projectable, ProjectorElementBuildDeskriptor } from 'app/site/base/projectable';
|
import { Projectable, ProjectorElementBuildDeskriptor } from 'app/site/base/projectable';
|
||||||
import { ProjectionDialogService } from 'app/core/services/projection-dialog.service';
|
import { ProjectionDialogService } from 'app/core/services/projection-dialog.service';
|
||||||
import { ProjectorService } from '../../../core/services/projector.service';
|
import { ProjectorService } from '../../../core/services/projector.service';
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import { Component, OnInit, Input, ViewChild, OnDestroy } from '@angular/core';
|
import { Component, OnInit, Input, ViewChild, OnDestroy } from '@angular/core';
|
||||||
import { FormControl, FormGroup } from '@angular/forms';
|
import { FormControl, FormGroup } from '@angular/forms';
|
||||||
import { Subject, ReplaySubject, BehaviorSubject, Subscription } from 'rxjs';
|
|
||||||
import { MatSelect } from '@angular/material';
|
import { MatSelect } from '@angular/material';
|
||||||
|
|
||||||
|
import { Subject, ReplaySubject, BehaviorSubject, Subscription } from 'rxjs';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { Selectable } from '../selectable';
|
import { Selectable } from '../selectable';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import { Component, OnInit, Input, Output, EventEmitter, ContentChild, TemplateRef, OnDestroy } from '@angular/core';
|
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 { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
|
||||||
|
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { Observable, Subscription } from 'rxjs';
|
||||||
|
|
||||||
import { Selectable } from '../selectable';
|
import { Selectable } from '../selectable';
|
||||||
import { EmptySelectable } from '../empty-selectable';
|
import { EmptySelectable } from '../empty-selectable';
|
||||||
import { Observable, Subscription } from 'rxjs';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reusable Sorting List
|
* Reusable Sorting List
|
||||||
|
@ -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 { OperatorService, Permission } from 'app/core/services/operator.service';
|
||||||
import { OpenSlidesComponent } from 'app/openslides.component';
|
import { OpenSlidesComponent } from 'app/openslides.component';
|
||||||
@ -13,7 +15,7 @@ import { OpenSlidesComponent } from 'app/openslides.component';
|
|||||||
@Directive({
|
@Directive({
|
||||||
selector: '[osPerms]'
|
selector: '[osPerms]'
|
||||||
})
|
})
|
||||||
export class PermsDirective extends OpenSlidesComponent {
|
export class PermsDirective extends OpenSlidesComponent implements OnInit, OnDestroy {
|
||||||
/**
|
/**
|
||||||
* Holds the required permissions the access a feature
|
* Holds the required permissions the access a feature
|
||||||
*/
|
*/
|
||||||
@ -46,6 +48,8 @@ export class PermsDirective extends OpenSlidesComponent {
|
|||||||
*/
|
*/
|
||||||
private complement: boolean;
|
private complement: boolean;
|
||||||
|
|
||||||
|
private operatorSubscription: Subscription | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the directive once. Observes the operator for it's groups so the
|
* Constructs the directive once. Observes the operator for it's groups so the
|
||||||
* directive can perform changes dynamically
|
* directive can perform changes dynamically
|
||||||
@ -60,13 +64,21 @@ export class PermsDirective extends OpenSlidesComponent {
|
|||||||
private operator: OperatorService
|
private operator: OperatorService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ngOnInit(): void {
|
||||||
// observe groups of operator, so the directive can actively react to changes
|
// 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();
|
this.updateView();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ngOnDestroy(): void {
|
||||||
|
if (this.operatorSubscription) {
|
||||||
|
this.operatorSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comes directly from the view.
|
* Comes directly from the view.
|
||||||
* The value defines the requires permissions as an array or a single permission.
|
* The value defines the requires permissions as an array or a single permission.
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { OnInit, ElementRef, Directive, Input } from '@angular/core';
|
import { OnInit, ElementRef, Directive, Input } from '@angular/core';
|
||||||
|
|
||||||
import { ResizeSensor } from 'css-element-queries';
|
import { ResizeSensor } from 'css-element-queries';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
placeholder="{{ 'New password' | translate }}"
|
placeholder="{{ 'New password' | translate }}"
|
||||||
/>
|
/>
|
||||||
<mat-icon
|
<mat-icon
|
||||||
|
class="pointer"
|
||||||
matSuffix
|
matSuffix
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
(click)="admin_generatePassword()">
|
(click)="admin_generatePassword()">
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
mat-form-field {
|
mat-form-field {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pointer {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user