fix(menu): edge compute menu not clickable EE-6804 (#11320)

pull/11333/head
cmeng 2024-03-07 12:11:59 +13:00 committed by GitHub
parent b5f839a920
commit 0ea21f2317
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View File

@ -62,7 +62,7 @@ export async function checkAuthorizations(transition: Transition) {
} }
if (access === 'edge-admin') { if (access === 'edge-admin') {
if (authService.isAdmin()) { if (authService.isAdmin(true)) {
return undefined; return undefined;
} }

View File

@ -133,16 +133,16 @@ angular.module('portainer.app').factory('Authentication', [
// To avoid creating divergence between CE and EE // To avoid creating divergence between CE and EE
// isAdmin checks if the user is a portainer admin or edge admin // isAdmin checks if the user is a portainer admin or edge admin
function isEdgeAdmin() { function isEdgeAdmin(noEnvScope = false) {
const environment = EndpointProvider.currentEndpoint(); 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 * @deprecated use Authentication.isAdmin instead
*/ */
function isAdmin() { function isAdmin(noEnvScope = false) {
return isEdgeAdmin(); return isEdgeAdmin(noEnvScope);
} }
// To avoid creating divergence between CE and EE // To avoid creating divergence between CE and EE

View File

@ -10,7 +10,7 @@ export interface StateManager {
export interface IAuthenticationService { export interface IAuthenticationService {
getUserDetails(): { ID: number }; getUserDetails(): { ID: number };
isAuthenticated(): boolean; isAuthenticated(): boolean;
isAdmin(): boolean; isAdmin(noEnvScope?: boolean): boolean;
isPureAdmin(): boolean; isPureAdmin(): boolean;
hasAuthorizations(authorizations: string[]): boolean; hasAuthorizations(authorizations: string[]): boolean;