refactor(core): Rename RequireGlobalScope to GlobalScope (no-changelog) (#8760)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-02-28 14:40:02 +01:00
committed by GitHub
parent 246bfb9ad4
commit 2811f77798
15 changed files with 70 additions and 77 deletions

View File

@@ -3,14 +3,7 @@ import { validate } from 'class-validator';
import type { PostBindingContext } from 'samlify/types/src/entity';
import url from 'url';
import {
Authorized,
Get,
NoAuthRequired,
Post,
RestController,
RequireGlobalScope,
} from '@/decorators';
import { Authorized, Get, NoAuthRequired, Post, RestController, GlobalScope } from '@/decorators';
import { AuthService } from '@/auth/auth.service';
import { AuthenticatedRequest } from '@/requests';
@@ -76,7 +69,7 @@ export class SamlController {
* Set SAML config
*/
@Post(SamlUrls.config, { middlewares: [samlLicensedMiddleware] })
@RequireGlobalScope('saml:manage')
@GlobalScope('saml:manage')
async configPost(req: SamlConfiguration.Update) {
const validationResult = await validate(req.body);
if (validationResult.length === 0) {
@@ -95,7 +88,7 @@ export class SamlController {
* Set SAML config
*/
@Post(SamlUrls.configToggleEnabled, { middlewares: [samlLicensedMiddleware] })
@RequireGlobalScope('saml:manage')
@GlobalScope('saml:manage')
async toggleEnabledPost(req: SamlConfiguration.Toggle, res: express.Response) {
if (req.body.loginEnabled === undefined) {
throw new BadRequestError('Body should contain a boolean "loginEnabled" property');
@@ -211,7 +204,7 @@ export class SamlController {
* This endpoint is available if SAML is licensed and the requestor is an instance owner
*/
@Get(SamlUrls.configTest, { middlewares: [samlLicensedMiddleware] })
@RequireGlobalScope('saml:manage')
@GlobalScope('saml:manage')
async configTestGet(req: AuthenticatedRequest, res: express.Response) {
return await this.handleInitSSO(res, getServiceProviderConfigTestReturnUrl());
}