mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-10 01:19:53 +01:00
* refactor: allow existing tsc errors * refactor: add missing component key * refactor: port login auth to TS/SWR * refactor: replace incorrect CREATE_TAG_TYPE with UPDATE_TAG_TYPE * refactor: fix AccessProvider permission mocks * refactor: add types to AccessContext * refactor: fix file extension * refactor: remove default export * refactor: remove unused IAddedUser interface * refactor: comment on the permissions prop * refactor: split auth hooks * feat: auth tests * fix: setup separate e2e tests * fix: naming * fix: lint * fix: spec path * fix: missing store * feat: add more tests Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
22 lines
461 B
TypeScript
22 lines
461 B
TypeScript
import React from 'react';
|
|
|
|
export interface IAccessContext {
|
|
isAdmin: boolean;
|
|
hasAccess: (
|
|
permission: 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;
|