backend: Add UserService for user role management and update dependency injector
This commit is contained in:
parent
bc6472924a
commit
570c830f63
@ -1,5 +1,4 @@
|
||||
import { Container } from 'inversify';
|
||||
|
||||
import {
|
||||
AuthService,
|
||||
GlobalPreferencesService,
|
||||
@ -17,7 +16,8 @@ import {
|
||||
S3Service,
|
||||
SystemEventService,
|
||||
TaskSchedulerService,
|
||||
TokenService
|
||||
TokenService,
|
||||
UserService
|
||||
} from '../services/index.js';
|
||||
|
||||
const container: Container = new Container();
|
||||
@ -37,6 +37,7 @@ const registerDependencies = () => {
|
||||
container.bind(TaskSchedulerService).toSelf().inSingletonScope();
|
||||
container.bind(LoggerService).toSelf().inSingletonScope();
|
||||
container.bind(AuthService).toSelf().inSingletonScope();
|
||||
container.bind(UserService).toSelf().inSingletonScope();
|
||||
container.bind(TokenService).toSelf().inSingletonScope();
|
||||
container.bind(LiveKitService).toSelf().inSingletonScope();
|
||||
container.bind(RoomService).toSelf().inSingletonScope();
|
||||
|
||||
@ -15,4 +15,4 @@ export * from './redis.service.js';
|
||||
export * from './s3.service.js';
|
||||
export * from './preferences/s3-preferences-storage.js';
|
||||
export * from './token.service.js';
|
||||
|
||||
export * from './user.service.js';
|
||||
|
||||
24
backend/src/services/user.service.ts
Normal file
24
backend/src/services/user.service.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { MEET_ADMIN_USER, MEET_USER } from '../environment.js';
|
||||
import { injectable } from '../config/dependency-injector.config.js';
|
||||
import { Role, User } from '@typings-ce';
|
||||
|
||||
@injectable()
|
||||
export class UserService {
|
||||
getUser(username: string): User | null {
|
||||
if (username === MEET_ADMIN_USER) {
|
||||
return {
|
||||
username: MEET_ADMIN_USER,
|
||||
role: Role.ADMIN
|
||||
};
|
||||
}
|
||||
|
||||
if (username === MEET_USER) {
|
||||
return {
|
||||
username: MEET_USER,
|
||||
role: Role.USER
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user