feat: add AdminGuard to DatabaseManagerController, ProjectController, and RedisManagerController for enhanced access control
This commit is contained in:
@ -3,6 +3,7 @@ import { DatabaseManagerService } from "./database.manager.service";
|
||||
import { DatabaseNodeService } from "../databaseNode/database.node.service";
|
||||
import { MigrationService } from "../migration/migration.service";
|
||||
import { ApiTokenGuard } from "src/api/guards/api-token.guard";
|
||||
import { AdminGuard } from "src/api/guards/admin.guard";
|
||||
|
||||
@Controller("database")
|
||||
@UseGuards(ApiTokenGuard)
|
||||
@ -14,11 +15,13 @@ export class DatabaseManagerController {
|
||||
) {}
|
||||
|
||||
@Post("create")
|
||||
@UseGuards(AdminGuard)
|
||||
createDatabase(@Body() body: { projectId: string }) {
|
||||
return this.databaseManagerService.createDatabase(body.projectId);
|
||||
}
|
||||
|
||||
@Post("node/create")
|
||||
@UseGuards(AdminGuard)
|
||||
addDatabaseNode(
|
||||
@Body()
|
||||
body: {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import { Body, Controller, Inject, Put, UseGuards } from "@nestjs/common";
|
||||
import { ProjectService } from "./project.service";
|
||||
import { ApiTokenGuard } from "src/api/guards/api-token.guard";
|
||||
import { AdminGuard } from "src/api/guards/admin.guard";
|
||||
|
||||
@Controller("project")
|
||||
@UseGuards(ApiTokenGuard)
|
||||
@UseGuards(AdminGuard)
|
||||
export class ProjectController {
|
||||
constructor(
|
||||
@Inject(ProjectService)
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import { Body, Controller, Post, UseGuards } from "@nestjs/common";
|
||||
import { RedisNodeService } from "./redisNode/redis.node.service";
|
||||
import { ApiTokenGuard } from "src/api/guards/api-token.guard";
|
||||
import { AdminGuard } from "src/api/guards/admin.guard";
|
||||
|
||||
@Controller("redis")
|
||||
@UseGuards(ApiTokenGuard)
|
||||
@UseGuards(AdminGuard)
|
||||
export class RedisManagerController {
|
||||
constructor(private readonly redisNodeService: RedisNodeService) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user