oiu-core 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { MongoAbility } from '@casl/ability';
|
|
3
3
|
import { Identity, Permission } from './_type';
|
|
4
|
-
export type PermissionFn = (identity?:
|
|
4
|
+
export type PermissionFn<TIdentity extends Identity> = (identity?: TIdentity) => {
|
|
5
5
|
allowed: Permission[];
|
|
6
6
|
denied: Permission[];
|
|
7
7
|
};
|
|
8
|
-
export type AuthorizationProviderProps = PropsWithChildren<{
|
|
8
|
+
export type AuthorizationProviderProps<TIdentity extends Identity> = PropsWithChildren<{
|
|
9
9
|
/** Optional CSS class name to apply to the Wait component wrapper */
|
|
10
10
|
className?: string;
|
|
11
11
|
/** Get permission for the current identity */
|
|
12
|
-
getPermissionFor: PermissionFn
|
|
12
|
+
getPermissionFor: PermissionFn<TIdentity>;
|
|
13
13
|
/** Default ability to be use */
|
|
14
14
|
defaultAbility?: MongoAbility;
|
|
15
15
|
}>;
|
|
@@ -18,5 +18,5 @@ export type AuthorizationProviderProps = PropsWithChildren<{
|
|
|
18
18
|
* @param param0
|
|
19
19
|
* @returns
|
|
20
20
|
*/
|
|
21
|
-
export declare function AuthorizationProvider({ className, children, getPermissionFor, defaultAbility }: AuthorizationProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function AuthorizationProvider<TIdentity extends Identity>({ className, children, getPermissionFor, defaultAbility }: AuthorizationProviderProps<TIdentity>): import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
//# sourceMappingURL=AuthorizationProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthorizationProvider.d.ts","sourceRoot":"","sources":["../../lib/auth/AuthorizationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAgC,MAAM,OAAO,CAAC;AAGxE,OAAO,EAAsC,YAAY,EAAE,MAAM,eAAe,CAAC;AAKjF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAa/C,MAAM,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"AuthorizationProvider.d.ts","sourceRoot":"","sources":["../../lib/auth/AuthorizationProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAgC,MAAM,OAAO,CAAC;AAGxE,OAAO,EAAsC,YAAY,EAAE,MAAM,eAAe,CAAC;AAKjF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAa/C,MAAM,MAAM,YAAY,CAAC,SAAS,SAAS,QAAQ,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,KAAK;IAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IAAC,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC;AACjI,MAAM,MAAM,0BAA0B,CAAC,SAAS,SAAS,QAAQ,IAAI,iBAAiB,CAAC;IACnF,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,gBAAgB,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1C,gCAAgC;IAChC,cAAc,CAAC,EAAE,YAAY,CAAC;CACjC,CAAC,CAAC;AACH;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,SAAS,QAAQ,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,EAAE,0BAA0B,CAAC,SAAS,CAAC,2CA0CjK"}
|
package/dist/auth/utils.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function useAuthentication(): IAuthService;
|
|
|
9
9
|
* Retrieve the current identity in the system
|
|
10
10
|
* @returns {Identity | undefined} The current identity
|
|
11
11
|
*/
|
|
12
|
-
export declare function useIdentity():
|
|
12
|
+
export declare function useIdentity<TIdentity extends Identity = Identity>(): TIdentity | undefined;
|
|
13
13
|
/** Function to check if the user has the permission */
|
|
14
14
|
export type AllowedFn = (permission: Permission) => boolean;
|
|
15
15
|
/**
|
package/dist/auth/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/auth/utils.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,iBAAiB,EAAoC,MAAM,OAAO,CAAC;AAM3F,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAM7D;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,CAKhD;AACD;;;GAGG;AACH,wBAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/auth/utils.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,iBAAiB,EAAoC,MAAM,OAAO,CAAC;AAM3F,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAM7D;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,CAKhD;AACD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,SAAS,SAAS,QAAQ,GAAG,QAAQ,KAAK,SAAS,GAAG,SAAS,CAE1F;AAED,uDAAuD;AACvD,MAAM,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC;AAC5D;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;CAc5B,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAGvD;AAQD;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC;IACzC,gCAAgC;IAChC,UAAU,EAAE,UAAU,CAAC;CAC1B,CAAC,CAAC;AACH;;;;GAIG;AACH,eAAO,MAAM,OAAO,iEAAmC,YAAY,6CAQjE,CAAC"}
|