mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor(server): make access core singleton (#4609)
This commit is contained in:
parent
36b3521be8
commit
50bc92aac0
9 changed files with 28 additions and 10 deletions
|
|
@ -37,8 +37,22 @@ export enum Permission {
|
|||
PERSON_MERGE = 'person.merge',
|
||||
}
|
||||
|
||||
let instance: AccessCore | null;
|
||||
|
||||
export class AccessCore {
|
||||
constructor(private repository: IAccessRepository) {}
|
||||
private constructor(private repository: IAccessRepository) {}
|
||||
|
||||
static create(repository: IAccessRepository) {
|
||||
if (!instance) {
|
||||
instance = new AccessCore(repository);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
static reset() {
|
||||
instance = null;
|
||||
}
|
||||
|
||||
requireUploadAccess(authUser: AuthUserDto | null): AuthUserDto {
|
||||
if (!authUser || (authUser.isPublicUser && !authUser.isAllowUpload)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue