diff --git a/jslib b/jslib index 049e129f36..36ab2ec78b 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 049e129f3647ee807bdc68a3d0a38854b4ba0256 +Subproject commit 36ab2ec78b0b235008312ab70c16882d28fd76b7 diff --git a/src/app/organizations/manage/events.component.ts b/src/app/organizations/manage/events.component.ts index 811b681150..dfeaa798f5 100644 --- a/src/app/organizations/manage/events.component.ts +++ b/src/app/organizations/manage/events.component.ts @@ -2,12 +2,13 @@ import { Component, OnInit, } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { ToasterService } from 'angular2-toaster'; import { ApiService } from 'jslib/abstractions/api.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; +import { UserService } from 'jslib/abstractions/user.service'; import { EventService } from '../../services/event.service'; @@ -34,11 +35,17 @@ export class EventsComponent implements OnInit { constructor(private apiService: ApiService, private route: ActivatedRoute, private eventService: EventService, private i18nService: I18nService, - private toasterService: ToasterService) { } + private toasterService: ToasterService, private userService: UserService, + private router: Router) { } async ngOnInit() { this.route.parent.parent.params.subscribe(async (params) => { this.organizationId = params.organizationId; + const organization = await this.userService.getOrganization(this.organizationId); + if (organization == null || !organization.useEvents) { + this.router.navigate(['/organizations', this.organizationId]); + return; + } const defaultDates = this.eventService.getDefaultDateFilters(); this.start = defaultDates[0]; this.end = defaultDates[1]; diff --git a/src/app/organizations/manage/groups.component.ts b/src/app/organizations/manage/groups.component.ts index 4c731eddb1..752b3ae2c2 100644 --- a/src/app/organizations/manage/groups.component.ts +++ b/src/app/organizations/manage/groups.component.ts @@ -5,7 +5,10 @@ import { ViewChild, ViewContainerRef, } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; +import { + ActivatedRoute, + Router, +} from '@angular/router'; import { ToasterService } from 'angular2-toaster'; import { Angulartics2 } from 'angulartics2'; @@ -13,6 +16,7 @@ import { Angulartics2 } from 'angulartics2'; import { ApiService } from 'jslib/abstractions/api.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; +import { UserService } from 'jslib/abstractions/user.service'; import { GroupResponse } from 'jslib/models/response/groupResponse'; @@ -40,11 +44,17 @@ export class GroupsComponent implements OnInit { constructor(private apiService: ApiService, private route: ActivatedRoute, private i18nService: I18nService, private componentFactoryResolver: ComponentFactoryResolver, private analytics: Angulartics2, private toasterService: ToasterService, - private platformUtilsService: PlatformUtilsService) { } + private platformUtilsService: PlatformUtilsService, private userService: UserService, + private router: Router) { } async ngOnInit() { this.route.parent.parent.params.subscribe(async (params) => { this.organizationId = params.organizationId; + const organization = await this.userService.getOrganization(this.organizationId); + if (organization == null || !organization.useGroups) { + this.router.navigate(['/organizations', this.organizationId]); + return; + } await this.load(); }); } diff --git a/src/app/organizations/manage/manage.component.html b/src/app/organizations/manage/manage.component.html index 786bff8ee7..412b865630 100644 --- a/src/app/organizations/manage/manage.component.html +++ b/src/app/organizations/manage/manage.component.html @@ -10,10 +10,10 @@ {{'collections' | i18n}} - + {{'groups' | i18n}} - + {{'eventLogs' | i18n}} diff --git a/src/app/organizations/manage/manage.component.ts b/src/app/organizations/manage/manage.component.ts index 1d2f36c96d..730d0b44f2 100644 --- a/src/app/organizations/manage/manage.component.ts +++ b/src/app/organizations/manage/manage.component.ts @@ -1,7 +1,26 @@ -import { Component } from '@angular/core'; +import { + Component, + OnInit, +} from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { UserService } from 'jslib/abstractions/user.service'; @Component({ selector: 'app-org-manage', templateUrl: 'manage.component.html', }) -export class ManageComponent { } +export class ManageComponent implements OnInit { + accessGroups = false; + accessEvents = false; + + constructor(private route: ActivatedRoute, private userService: UserService) { } + + ngOnInit() { + this.route.parent.params.subscribe(async (params) => { + const organization = await this.userService.getOrganization(params.organizationId); + this.accessEvents = organization.useEvents; + this.accessGroups = organization.useGroups; + }); + } +}