@whippsp/auth0-helper 1.1.2 → 1.1.3
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/Auth0Helper.js +1 -1
- package/index.d.ts +7 -0
- package/package.json +1 -1
package/Auth0Helper.js
CHANGED
|
@@ -27,7 +27,7 @@ module.exports = function(userModule, initialConfig = {}) {
|
|
|
27
27
|
runtimeConfig = { ...runtimeConfig, ...newConfig };
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
api.user.
|
|
30
|
+
api.user.hasrole = (requestedRole) => {
|
|
31
31
|
const roles = event.authorization?.roles || [];
|
|
32
32
|
const hasIt = roles.includes(requestedRole);
|
|
33
33
|
|
package/index.d.ts
CHANGED
|
@@ -5,6 +5,13 @@ export interface HelperConfig {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
declare global {
|
|
8
|
+
|
|
9
|
+
interface UserAPI {
|
|
10
|
+
/** * Returns true if the user has the specified Auth0 Role
|
|
11
|
+
*/
|
|
12
|
+
hasRole(roleName: string): boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
// This covers Post-Login
|
|
9
16
|
interface PostLoginAPI {
|
|
10
17
|
skipRemaining(): void;
|