1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/frontend/src/contexts/AccessContext.ts

22 lines
472 B
TypeScript
Raw Normal View History

import React from 'react';
export interface IAccessContext {
isAdmin: boolean;
hasAccess: (
permission: string | string[],
project?: string,
environment?: string
) => boolean;
}
const hasAccessPlaceholder = () => {
throw new Error('hasAccess called outside AccessContext');
};
const AccessContext = React.createContext<IAccessContext>({
isAdmin: false,
hasAccess: hasAccessPlaceholder,
});
export default AccessContext;