fix(editor): Handle permission edge cases (empty scopes) (#7723)
This commit is contained in:
@@ -21,7 +21,7 @@ import { WithTimestamps, jsonColumnType } from './AbstractEntity';
|
||||
import type { IPersonalizationSurveyAnswers } from '@/Interfaces';
|
||||
import type { AuthIdentity } from './AuthIdentity';
|
||||
import { ownerPermissions, memberPermissions } from '@/permissions/roles';
|
||||
import { hasScope, type HasScopeOptions, type Scope } from '@n8n/permissions';
|
||||
import { hasScope, type ScopeOptions, type Scope } from '@n8n/permissions';
|
||||
|
||||
export const MIN_PASSWORD_LENGTH = 8;
|
||||
|
||||
@@ -137,16 +137,13 @@ export class User extends WithTimestamps implements IUser {
|
||||
return STATIC_SCOPE_MAP[this.globalRole?.name] ?? [];
|
||||
}
|
||||
|
||||
async hasGlobalScope(
|
||||
scope: Scope | Scope[],
|
||||
hasScopeOptions?: HasScopeOptions,
|
||||
): Promise<boolean> {
|
||||
async hasGlobalScope(scope: Scope | Scope[], scopeOptions?: ScopeOptions): Promise<boolean> {
|
||||
return hasScope(
|
||||
scope,
|
||||
{
|
||||
global: this.globalScopes,
|
||||
},
|
||||
hasScopeOptions,
|
||||
scopeOptions,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user