diff --git a/app/portainer/authorization-guard.ts b/app/portainer/authorization-guard.ts index 728a9cab1..7b128abdd 100644 --- a/app/portainer/authorization-guard.ts +++ b/app/portainer/authorization-guard.ts @@ -62,7 +62,7 @@ export async function checkAuthorizations(transition: Transition) { } if (access === 'edge-admin') { - if (authService.isAdmin()) { + if (authService.isAdmin(true)) { return undefined; } diff --git a/app/portainer/services/authentication.js b/app/portainer/services/authentication.js index 4039abfba..3825aff27 100644 --- a/app/portainer/services/authentication.js +++ b/app/portainer/services/authentication.js @@ -133,16 +133,16 @@ angular.module('portainer.app').factory('Authentication', [ // To avoid creating divergence between CE and EE // isAdmin checks if the user is a portainer admin or edge admin - function isEdgeAdmin() { + function isEdgeAdmin(noEnvScope = false) { const environment = EndpointProvider.currentEndpoint(); - return userHelpers.isEdgeAdmin({ Role: user.role }, environment); + return userHelpers.isEdgeAdmin({ Role: user.role }, noEnvScope ? undefined : environment); } /** * @deprecated use Authentication.isAdmin instead */ - function isAdmin() { - return isEdgeAdmin(); + function isAdmin(noEnvScope = false) { + return isEdgeAdmin(noEnvScope); } // To avoid creating divergence between CE and EE diff --git a/app/portainer/services/types.ts b/app/portainer/services/types.ts index 54dbc6f94..dd18201e3 100644 --- a/app/portainer/services/types.ts +++ b/app/portainer/services/types.ts @@ -10,7 +10,7 @@ export interface StateManager { export interface IAuthenticationService { getUserDetails(): { ID: number }; isAuthenticated(): boolean; - isAdmin(): boolean; + isAdmin(noEnvScope?: boolean): boolean; isPureAdmin(): boolean; hasAuthorizations(authorizations: string[]): boolean;