diff --git a/src/frontend/app/model/network/authentication.service.ts b/src/frontend/app/model/network/authentication.service.ts index b269d884..3189e670 100644 --- a/src/frontend/app/model/network/authentication.service.ts +++ b/src/frontend/app/model/network/authentication.service.ts @@ -8,7 +8,7 @@ import {NetworkService} from './network.service'; import {ErrorCodes, ErrorDTO} from '../../../../common/entities/Error'; import {CookieNames} from '../../../../common/CookieNames'; import {ShareService} from '../../ui/gallery/share.service'; -import { CookieService } from 'ngx-cookie-service'; +import {CookieService} from 'ngx-cookie-service'; /* Injected config / user from server side */ // tslint:disable-next-line:no-internal-module no-namespace @@ -85,6 +85,10 @@ export class AuthenticationService { return this.user.value && this.user.value.role >= role; } + public canSearch(): boolean { + return this.isAuthorized(UserRoles.Guest); + } + public async logout(): Promise { await this.userService.logout(); this.user.next(null); diff --git a/src/frontend/app/ui/gallery/gallery.component.ts b/src/frontend/app/ui/gallery/gallery.component.ts index b860390a..e01c29fa 100644 --- a/src/frontend/app/ui/gallery/gallery.component.ts +++ b/src/frontend/app/ui/gallery/gallery.component.ts @@ -99,9 +99,9 @@ export class GalleryComponent implements OnInit, OnDestroy { return this.navigation.toLogin(); } - this.showSearchBar = Config.Client.Search.enabled && this.authService.isAuthorized(UserRoles.Guest); + this.showSearchBar = Config.Client.Search.enabled && this.authService.canSearch(); this.showShare = Config.Client.Sharing.enabled && this.authService.isAuthorized(UserRoles.User); - this.showRandomPhotoBuilder = Config.Client.RandomPhoto.enabled && this.authService.isAuthorized(UserRoles.Guest); + this.showRandomPhotoBuilder = Config.Client.RandomPhoto.enabled && this.authService.isAuthorized(UserRoles.User); this.subscription.content = this.galleryService.content.subscribe(this.onContentChange); this.subscription.route = this.route.params.subscribe(this.onRoute); diff --git a/src/frontend/app/ui/gallery/grid/photo/photo.grid.gallery.component.ts b/src/frontend/app/ui/gallery/grid/photo/photo.grid.gallery.component.ts index 4aa24a20..c2891fd2 100644 --- a/src/frontend/app/ui/gallery/grid/photo/photo.grid.gallery.component.ts +++ b/src/frontend/app/ui/gallery/grid/photo/photo.grid.gallery.component.ts @@ -7,6 +7,8 @@ import {Config} from '../../../../../../common/config/public/Config'; import {PageHelper} from '../../../../model/page.helper'; import {PhotoDTO, PhotoMetadata} from '../../../../../../common/entities/PhotoDTO'; import {SearchQueryTypes, TextSearch, TextSearchQueryMatchTypes} from '../../../../../../common/entities/SearchQueryDTO'; +import {UserRoles} from '../../../../../../common/entities/UserDTO'; +import {AuthenticationService} from '../../../../model/network/authentication.service'; @Component({ selector: 'app-gallery-grid-photo', @@ -29,8 +31,9 @@ export class GalleryPhotoComponent implements IRenderable, OnInit, OnDestroy { wasInView: boolean = null; - constructor(private thumbnailService: ThumbnailManagerService) { - this.searchEnabled = Config.Client.Search.enabled; + constructor(private thumbnailService: ThumbnailManagerService, + private authService: AuthenticationService) { + this.searchEnabled = Config.Client.Search.enabled && this.authService.canSearch(); } get ScrollListener(): boolean { diff --git a/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.html b/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.html index 178580c1..2d84ccc0 100644 --- a/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.html +++ b/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.html @@ -56,17 +56,31 @@ [style.width.px]="faceContainerDim.width* zoom" [style.height.px]="faceContainerDim.height* zoom" *ngIf="facesEnabled && activePhoto && activePhoto.gridMedia.Photo.metadata.faces && activePhoto.gridMedia.Photo.metadata.faces.length > 0"> - -
- {{face.name}} -
+ + +
+ {{face.name}} +
+
+ +
+
+ {{face.name}} +
+
diff --git a/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.ts b/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.ts index 5365e432..53a805cf 100644 --- a/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.ts +++ b/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.ts @@ -8,6 +8,7 @@ import {PhotoDTO} from '../../../../../../common/entities/PhotoDTO'; import {GalleryLightboxMediaComponent} from '../media/media.lightbox.gallery.component'; import {Config} from '../../../../../../common/config/public/Config'; import {SearchQueryTypes, TextSearch, TextSearchQueryMatchTypes} from '../../../../../../common/entities/SearchQueryDTO'; +import {AuthenticationService} from '../../../../model/network/authentication.service'; export enum PlayBackStates { Paused = 1, @@ -48,13 +49,16 @@ export class ControlsLightboxComponent implements OnDestroy, OnInit, OnChanges { public drag = {x: 0, y: 0}; public SearchQueryTypes = SearchQueryTypes; public faceContainerDim = {width: 0, height: 0}; + public searchEnabled: boolean; private visibilityTimer: number = null; private timer: Observable; private timerSub: Subscription; private prevDrag = {x: 0, y: 0}; private prevZoom = 1; - constructor(public fullScreenService: FullScreenService) { + constructor(public fullScreenService: FullScreenService, + private authService: AuthenticationService) { + this.searchEnabled = Config.Client.Search.enabled && this.authService.canSearch(); } public get Zoom(): number { diff --git a/src/frontend/app/ui/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component.ts b/src/frontend/app/ui/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component.ts index 7de63ba4..c50d5f45 100644 --- a/src/frontend/app/ui/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component.ts +++ b/src/frontend/app/ui/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component.ts @@ -7,6 +7,7 @@ import {Utils} from '../../../../../../common/Utils'; import {QueryService} from '../../../../model/query.service'; import {MapService} from '../../map/map.service'; import {SearchQueryTypes, TextSearch, TextSearchQueryMatchTypes} from '../../../../../../common/entities/SearchQueryDTO'; +import {AuthenticationService} from '../../../../model/network/authentication.service'; @Component({ selector: 'app-info-panel', @@ -23,9 +24,10 @@ export class InfoPanelLightboxComponent implements OnInit { readonly SearchQueryTypes: typeof SearchQueryTypes = SearchQueryTypes; constructor(public queryService: QueryService, - public mapService: MapService) { + public mapService: MapService, + private authService: AuthenticationService) { this.mapEnabled = Config.Client.Map.enabled; - this.searchEnabled = Config.Client.Search.enabled; + this.searchEnabled = Config.Client.Search.enabled && this.authService.canSearch(); } get FullPath(): string {