mirror of
https://github.com/immich-app/immich.git
synced 2024-12-24 10:37:28 +02:00
feat(cli): list users (#1341)
This commit is contained in:
parent
177cc3d7f9
commit
adacfb1110
BIN
docs/docs/features/img/list-users.png
Normal file
BIN
docs/docs/features/img/list-users.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
@ -8,6 +8,7 @@ The `immich-server` docker image comes preinstalled with an administrative CLI (
|
||||
| `reset-admin-password` | Reset the password for the admin user |
|
||||
| `disable-password-login` | Disable password login |
|
||||
| `enable-password-login` | Enable password login |
|
||||
| `list-users` | List Immich users |
|
||||
|
||||
## How to run a command
|
||||
|
||||
@ -26,3 +27,7 @@ Disable Password Login
|
||||
Enabled Password Login
|
||||
|
||||
![Enable Password Login](./img/enable-password-login.png)
|
||||
|
||||
List Users
|
||||
|
||||
![List Users](./img/list-users.png)
|
||||
|
@ -2,6 +2,7 @@ import { DomainModule } from '@app/domain';
|
||||
import { InfraModule, SystemConfigEntity } from '@app/infra';
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { ListUsersCommand } from './commands/list-users.command';
|
||||
import { DisablePasswordLoginCommand, EnablePasswordLoginCommand } from './commands/password-login';
|
||||
import { PromptPasswordQuestions, ResetAdminPasswordCommand } from './commands/reset-admin-password.command';
|
||||
|
||||
@ -17,6 +18,7 @@ import { PromptPasswordQuestions, ResetAdminPasswordCommand } from './commands/r
|
||||
PromptPasswordQuestions,
|
||||
EnablePasswordLoginCommand,
|
||||
DisablePasswordLoginCommand,
|
||||
ListUsersCommand,
|
||||
],
|
||||
})
|
||||
export class AppModule {}
|
||||
|
23
server/apps/cli/src/commands/list-users.command.ts
Normal file
23
server/apps/cli/src/commands/list-users.command.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { UserService } from '@app/domain';
|
||||
import { Command, CommandRunner } from 'nest-commander';
|
||||
import { CLI_USER } from '../constants';
|
||||
|
||||
@Command({
|
||||
name: 'list-users',
|
||||
description: 'List Immich users',
|
||||
})
|
||||
export class ListUsersCommand extends CommandRunner {
|
||||
constructor(private userService: UserService) {
|
||||
super();
|
||||
}
|
||||
|
||||
async run(): Promise<void> {
|
||||
try {
|
||||
const users = await this.userService.getAllUsers(CLI_USER, true);
|
||||
console.dir(users);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
console.error('Unable to load users');
|
||||
}
|
||||
}
|
||||
}
|
9
server/apps/cli/src/constants.ts
Normal file
9
server/apps/cli/src/constants.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { AuthUserDto } from '@app/domain';
|
||||
|
||||
export const CLI_USER: AuthUserDto = {
|
||||
id: 'cli',
|
||||
email: 'cli@immich.app',
|
||||
isAdmin: true,
|
||||
isPublicUser: false,
|
||||
isAllowUpload: true,
|
||||
};
|
Loading…
Reference in New Issue
Block a user