1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-01-10 04:07:35 +02:00

Hiding faces for guest users (sharing link). Fixes: #149

This commit is contained in:
Patrik J. Braun 2020-09-05 16:06:11 +02:00
parent 187e021463
commit e9468c154a
4 changed files with 8 additions and 3 deletions

View File

@ -33,7 +33,7 @@ export class PersonRouter {
app.get(['/api/person'],
// common part
AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.User),
AuthenticationMWs.authorise(Config.Client.Faces.readAccessMinRole),
VersionMWs.injectGalleryVersion,
// specific part

View File

@ -149,6 +149,8 @@ export module ClientConfig {
keywordsToPersons: boolean = true;
@ConfigProperty({type: UserRoles})
writeAccessMinRole: UserRoles = UserRoles.Admin;
@ConfigProperty({type: UserRoles})
readAccessMinRole: UserRoles = UserRoles.User;
}
@SubConfigClass()

View File

@ -17,7 +17,7 @@
[routerLink]="['/gallery']"
[queryParams]="queryService.getParams()" i18n>Gallery</a>
</li>
<li class="nav-item" [routerLinkActive]="['active']" *ngIf="facesEnabled">
<li class="nav-item" [routerLinkActive]="['active']" *ngIf="isFacesAvailable()">
<a class="nav-link" [routerLink]="['/faces']" i18n>Faces</a>
</li>
</ul>

View File

@ -20,7 +20,6 @@ export class FrameComponent {
public readonly authenticationRequired = Config.Client.authenticationRequired;
public readonly title = Config.Client.applicationTitle;
collapsed = true;
facesEnabled = Config.Client.Faces.enabled;
constructor(private _authService: AuthenticationService,
public notificationService: NotificationService,
@ -33,6 +32,10 @@ export class FrameComponent {
return this.user.value && this.user.value.role >= UserRoles.Admin;
}
isFacesAvailable() {
return Config.Client.Faces.enabled && this.user.value && this.user.value.role >= Config.Client.Faces.readAccessMinRole;
}
logout() {
this._authService.logout();