add util function to check if user is an admin

This commit is contained in:
Jacob Overgaard
2024-04-02 16:48:02 +02:00
parent 5bc8be81e3
commit a094719793
3 changed files with 13 additions and 1 deletions

View File

@@ -2,4 +2,5 @@ export * from './collection/index.js';
export * from './components/index.js';
export * from './invite/index.js';
export * from './repository/index.js';
export * from './types.js';
export type * from './types.js';
export * from './utils/index.js';

View File

@@ -0,0 +1 @@
export * from './is-user.function.js';

View File

@@ -0,0 +1,10 @@
import { UmbUserDetailRepository } from '../repository/index.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export const isUserAdmin = async (host: UmbControllerHost, userUnique: string) => {
const repository = new UmbUserDetailRepository(host);
const { data: user } = await repository.requestByUnique(userUnique);
//return user?.isAdmin;
return false;
};