refactor(core): Rename RequireGlobalScope to GlobalScope (no-changelog) (#8760)
This commit is contained in:
committed by
GitHub
parent
246bfb9ad4
commit
2811f77798
@@ -13,7 +13,7 @@ import {
|
||||
Patch,
|
||||
Post,
|
||||
RestController,
|
||||
RequireGlobalScope,
|
||||
GlobalScope,
|
||||
} from '@/decorators';
|
||||
import { NodeRequest } from '@/requests';
|
||||
import type { InstalledPackages } from '@db/entities/InstalledPackages';
|
||||
@@ -62,7 +62,7 @@ export class CommunityPackagesController {
|
||||
}
|
||||
|
||||
@Post('/')
|
||||
@RequireGlobalScope('communityPackage:install')
|
||||
@GlobalScope('communityPackage:install')
|
||||
async installPackage(req: NodeRequest.Post) {
|
||||
const { name } = req.body;
|
||||
|
||||
@@ -159,7 +159,7 @@ export class CommunityPackagesController {
|
||||
}
|
||||
|
||||
@Get('/')
|
||||
@RequireGlobalScope('communityPackage:list')
|
||||
@GlobalScope('communityPackage:list')
|
||||
async getInstalledPackages() {
|
||||
const installedPackages = await this.communityPackagesService.getAllInstalledPackages();
|
||||
|
||||
@@ -194,7 +194,7 @@ export class CommunityPackagesController {
|
||||
}
|
||||
|
||||
@Delete('/')
|
||||
@RequireGlobalScope('communityPackage:uninstall')
|
||||
@GlobalScope('communityPackage:uninstall')
|
||||
async uninstallPackage(req: NodeRequest.Delete) {
|
||||
const { name } = req.query;
|
||||
|
||||
@@ -246,7 +246,7 @@ export class CommunityPackagesController {
|
||||
}
|
||||
|
||||
@Patch('/')
|
||||
@RequireGlobalScope('communityPackage:update')
|
||||
@GlobalScope('communityPackage:update')
|
||||
async updatePackage(req: NodeRequest.Update) {
|
||||
const { name } = req.body;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import validator from 'validator';
|
||||
|
||||
import { AuthService } from '@/auth/auth.service';
|
||||
import config from '@/config';
|
||||
import { Authorized, NoAuthRequired, Post, RequireGlobalScope, RestController } from '@/decorators';
|
||||
import { Authorized, NoAuthRequired, Post, GlobalScope, RestController } from '@/decorators';
|
||||
import { RESPONSE_ERROR_MESSAGES } from '@/constants';
|
||||
import { UserRequest } from '@/requests';
|
||||
import { License } from '@/License';
|
||||
@@ -39,7 +39,7 @@ export class InvitationController {
|
||||
*/
|
||||
|
||||
@Post('/')
|
||||
@RequireGlobalScope('user:create')
|
||||
@GlobalScope('user:create')
|
||||
async inviteUser(req: UserRequest.Invite) {
|
||||
const isWithinUsersLimit = this.license.isWithinUsersLimit();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Authorized, Post, RestController, RequireGlobalScope } from '@/decorators';
|
||||
import { Authorized, Post, RestController, GlobalScope } from '@/decorators';
|
||||
import { OrchestrationRequest } from '@/requests';
|
||||
import { OrchestrationService } from '@/services/orchestration.service';
|
||||
import { License } from '@/License';
|
||||
@@ -15,7 +15,7 @@ export class OrchestrationController {
|
||||
* These endpoints do not return anything, they just trigger the messsage to
|
||||
* the workers to respond on Redis with their status.
|
||||
*/
|
||||
@RequireGlobalScope('orchestration:read')
|
||||
@GlobalScope('orchestration:read')
|
||||
@Post('/worker/status/:id')
|
||||
async getWorkersStatus(req: OrchestrationRequest.Get) {
|
||||
if (!this.licenseService.isWorkerViewLicensed()) return;
|
||||
@@ -23,14 +23,14 @@ export class OrchestrationController {
|
||||
return await this.orchestrationService.getWorkerStatus(id);
|
||||
}
|
||||
|
||||
@RequireGlobalScope('orchestration:read')
|
||||
@GlobalScope('orchestration:read')
|
||||
@Post('/worker/status')
|
||||
async getWorkersStatusAll() {
|
||||
if (!this.licenseService.isWorkerViewLicensed()) return;
|
||||
return await this.orchestrationService.getWorkerStatus();
|
||||
}
|
||||
|
||||
@RequireGlobalScope('orchestration:list')
|
||||
@GlobalScope('orchestration:list')
|
||||
@Post('/worker/ids')
|
||||
async getWorkerIdsAll() {
|
||||
if (!this.licenseService.isWorkerViewLicensed()) return;
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
Patch,
|
||||
Post,
|
||||
RestController,
|
||||
RequireGlobalScope,
|
||||
GlobalScope,
|
||||
} from '@/decorators';
|
||||
import { TagService } from '@/services/tag.service';
|
||||
import { TagsRequest } from '@/requests';
|
||||
@@ -30,13 +30,13 @@ export class TagsController {
|
||||
}
|
||||
|
||||
@Get('/')
|
||||
@RequireGlobalScope('tag:list')
|
||||
@GlobalScope('tag:list')
|
||||
async getAll(req: TagsRequest.GetAll) {
|
||||
return await this.tagService.getAll({ withUsageCount: req.query.withUsageCount === 'true' });
|
||||
}
|
||||
|
||||
@Post('/')
|
||||
@RequireGlobalScope('tag:create')
|
||||
@GlobalScope('tag:create')
|
||||
async createTag(req: TagsRequest.Create) {
|
||||
const tag = this.tagService.toEntity({ name: req.body.name });
|
||||
|
||||
@@ -44,7 +44,7 @@ export class TagsController {
|
||||
}
|
||||
|
||||
@Patch('/:id(\\w+)')
|
||||
@RequireGlobalScope('tag:update')
|
||||
@GlobalScope('tag:update')
|
||||
async updateTag(req: TagsRequest.Update) {
|
||||
const newTag = this.tagService.toEntity({ id: req.params.id, name: req.body.name.trim() });
|
||||
|
||||
@@ -52,7 +52,7 @@ export class TagsController {
|
||||
}
|
||||
|
||||
@Delete('/:id(\\w+)')
|
||||
@RequireGlobalScope('tag:delete')
|
||||
@GlobalScope('tag:delete')
|
||||
async deleteTag(req: TagsRequest.Delete) {
|
||||
const { id } = req.params;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { User } from '@db/entities/User';
|
||||
import { SharedCredentials } from '@db/entities/SharedCredentials';
|
||||
import { SharedWorkflow } from '@db/entities/SharedWorkflow';
|
||||
import {
|
||||
RequireGlobalScope,
|
||||
GlobalScope,
|
||||
Authorized,
|
||||
Delete,
|
||||
Get,
|
||||
@@ -89,7 +89,7 @@ export class UsersController {
|
||||
}
|
||||
|
||||
@Get('/', { middlewares: listQueryMiddleware })
|
||||
@RequireGlobalScope('user:list')
|
||||
@GlobalScope('user:list')
|
||||
async listUsers(req: ListQuery.Request) {
|
||||
const { listQueryOptions } = req;
|
||||
|
||||
@@ -110,7 +110,7 @@ export class UsersController {
|
||||
}
|
||||
|
||||
@Get('/:id/password-reset-link')
|
||||
@RequireGlobalScope('user:resetPassword')
|
||||
@GlobalScope('user:resetPassword')
|
||||
async getUserPasswordResetLink(req: UserRequest.PasswordResetLink) {
|
||||
const user = await this.userRepository.findOneOrFail({
|
||||
where: { id: req.params.id },
|
||||
@@ -124,7 +124,7 @@ export class UsersController {
|
||||
}
|
||||
|
||||
@Patch('/:id/settings')
|
||||
@RequireGlobalScope('user:update')
|
||||
@GlobalScope('user:update')
|
||||
async updateUserSettings(req: UserRequest.UserSettingsUpdate) {
|
||||
const payload = plainToInstance(UserSettingsUpdatePayload, req.body);
|
||||
|
||||
@@ -144,7 +144,7 @@ export class UsersController {
|
||||
* Delete a user. Optionally, designate a transferee for their workflows and credentials.
|
||||
*/
|
||||
@Delete('/:id')
|
||||
@RequireGlobalScope('user:delete')
|
||||
@GlobalScope('user:delete')
|
||||
async deleteUser(req: UserRequest.Delete) {
|
||||
const { id: idToDelete } = req.params;
|
||||
|
||||
@@ -296,7 +296,7 @@ export class UsersController {
|
||||
}
|
||||
|
||||
@Patch('/:id/role')
|
||||
@RequireGlobalScope('user:changeRole')
|
||||
@GlobalScope('user:changeRole')
|
||||
@Licensed('feat:advancedPermissions')
|
||||
async changeGlobalRole(req: UserRequest.ChangeRole) {
|
||||
const { NO_ADMIN_ON_OWNER, NO_USER, NO_OWNER_ON_OWNER } =
|
||||
|
||||
Reference in New Issue
Block a user