mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor(server): add base methods for access checks (#13349)
This commit is contained in:
parent
97edf90889
commit
8daa8073ae
17 changed files with 84 additions and 90 deletions
|
|
@ -38,6 +38,7 @@ import { ITrashRepository } from 'src/interfaces/trash.interface';
|
|||
import { IUserRepository } from 'src/interfaces/user.interface';
|
||||
import { IVersionHistoryRepository } from 'src/interfaces/version-history.interface';
|
||||
import { IViewRepository } from 'src/interfaces/view.interface';
|
||||
import { AccessRequest, checkAccess, requireAccess } from 'src/utils/access';
|
||||
import { getConfig, updateConfig } from 'src/utils/config';
|
||||
|
||||
export class BaseService {
|
||||
|
|
@ -95,7 +96,7 @@ export class BaseService {
|
|||
);
|
||||
}
|
||||
|
||||
private get repos() {
|
||||
private get configRepos() {
|
||||
return {
|
||||
configRepo: this.configRepository,
|
||||
metadataRepo: this.systemMetadataRepository,
|
||||
|
|
@ -104,10 +105,18 @@ export class BaseService {
|
|||
}
|
||||
|
||||
getConfig(options: { withCache: boolean }) {
|
||||
return getConfig(this.repos, options);
|
||||
return getConfig(this.configRepos, options);
|
||||
}
|
||||
|
||||
updateConfig(newConfig: SystemConfig) {
|
||||
return updateConfig(this.repos, newConfig);
|
||||
return updateConfig(this.configRepos, newConfig);
|
||||
}
|
||||
|
||||
requireAccess(request: AccessRequest) {
|
||||
return requireAccess(this.accessRepository, request);
|
||||
}
|
||||
|
||||
checkAccess(request: AccessRequest) {
|
||||
return checkAccess(this.accessRepository, request);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue