1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08: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'], app.get(['/api/person'],
// common part // common part
AuthenticationMWs.authenticate, AuthenticationMWs.authenticate,
AuthenticationMWs.authorise(UserRoles.User), AuthenticationMWs.authorise(Config.Client.Faces.readAccessMinRole),
VersionMWs.injectGalleryVersion, VersionMWs.injectGalleryVersion,
// specific part // specific part

View File

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

View File

@ -17,7 +17,7 @@
[routerLink]="['/gallery']" [routerLink]="['/gallery']"
[queryParams]="queryService.getParams()" i18n>Gallery</a> [queryParams]="queryService.getParams()" i18n>Gallery</a>
</li> </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> <a class="nav-link" [routerLink]="['/faces']" i18n>Faces</a>
</li> </li>
</ul> </ul>

View File

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