fix: define proper scope based on ee/ce in base create API

This commit is contained in:
Pranav C
2025-08-04 11:12:10 +00:00
parent f8244728ae
commit 83f168e141

View File

@@ -18,14 +18,19 @@ import { MetaApiLimiterGuard } from '~/guards/meta-api-limiter.guard';
import { TenantContext } from '~/decorators/tenant-context.decorator';
import { NcContext, NcRequest } from '~/interface/config';
import { BasesV3Service } from '~/services/v3/bases-v3.service';
import { isEE } from '~/utils';
// decide scope based on whether it's EE or CE
const BASE_SCOPE = isEE ? 'workspace' : 'org';
@UseGuards(MetaApiLimiterGuard, GlobalGuard)
@Controller()
export class BasesV3Controller {
constructor(protected readonly baseV3Service: BasesV3Service) {}
@Acl('baseList', {
scope: 'org',
// decide permission name based on whether it's EE or CE
@Acl(isEE ? 'workspaceBaseList' : 'baseList', {
scope: BASE_SCOPE,
})
@Get('/api/v3/meta/workspaces/:workspaceId/bases')
async list(
@@ -91,7 +96,7 @@ export class BasesV3Controller {
}
@Acl('baseCreate', {
scope: 'org',
scope: BASE_SCOPE,
})
@HttpCode(200)
@Post('/api/v3/meta/workspaces/:workspaceId/bases')