mirror of
https://github.com/immich-app/immich.git
synced 2025-12-20 01:11:46 +03:00
feat(web): Added admin user config to user settings (#15380)
* feat(web): Added admin user config to user settings * feat (web) - cleaned up the files and added tests * feat (web) - added missing files * feat (web) - updated per review comments * feat (web) - e2e admin command test failures
This commit is contained in:
@@ -37,6 +37,24 @@ export class CliService extends BaseService {
|
||||
await this.updateConfig(config);
|
||||
}
|
||||
|
||||
async grantAdminAccess(email: string): Promise<void> {
|
||||
const user = await this.userRepository.getByEmail(email);
|
||||
if (!user) {
|
||||
throw new Error('User does not exist');
|
||||
}
|
||||
|
||||
await this.userRepository.update(user.id, { isAdmin: true });
|
||||
}
|
||||
|
||||
async revokeAdminAccess(email: string): Promise<void> {
|
||||
const user = await this.userRepository.getByEmail(email);
|
||||
if (!user) {
|
||||
throw new Error('User does not exist');
|
||||
}
|
||||
|
||||
await this.userRepository.update(user.id, { isAdmin: false });
|
||||
}
|
||||
|
||||
async disableOAuthLogin(): Promise<void> {
|
||||
const config = await this.getConfig({ withCache: false });
|
||||
config.oauth.enabled = false;
|
||||
|
||||
Reference in New Issue
Block a user