1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: small improvements (#7090)

Fixing isAdmin method. It is not that critical, because that is mostly
for system users not real usage.
Also fixing wording for outdated sdks.
This commit is contained in:
Jaanus Sellin 2024-05-21 12:40:52 +03:00 committed by GitHub
parent 45c75a65ce
commit 4f46f03843
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -36,7 +36,7 @@ export const OutdatedSdksBanner = ({ project }: IOutdatedSdksBannerProps) => {
};
const outdatedSdksBanner: IBanner = {
message: `We noticed that an outdated SDK version is connected to this Unleash instance.`,
message: `We noticed that an outdated SDK version is connected to ${project} project.`,
variant: 'warning',
link: 'dialog',
linkText: 'Please update those versions',

View File

@ -41,11 +41,13 @@ import BadDataError from '../error/bad-data-error';
import type { IGroup } from '../types/group';
import type { GroupService } from './group-service';
import {
ADMIN_TOKEN_USER,
type IUnleashConfig,
type IUserAccessOverview,
RoleCreatedEvent,
RoleDeletedEvent,
RoleUpdatedEvent,
SYSTEM_USER_ID,
} from '../types';
import type EventService from '../features/events/event-service';
@ -889,6 +891,9 @@ export class AccessService {
}
async isRootAdmin(userId: number): Promise<boolean> {
if (userId === SYSTEM_USER_ID || userId === ADMIN_TOKEN_USER.id) {
return true;
}
const roles = await this.store.getRolesForUserId(userId);
return roles.some(
(role) => role.name.toLowerCase() === ADMIN.toLowerCase(),