@webiny/app-security-access-management 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7
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/Extension.d.ts +2 -0
- package/Extension.js +83 -0
- package/Extension.js.map +1 -0
- package/README.md +7 -113
- package/SecurityPermissions.d.ts +2 -0
- package/SecurityPermissions.js +45 -0
- package/SecurityPermissions.js.map +1 -0
- package/{plugins/constants.d.ts → constants.d.ts} +1 -1
- package/{plugins/constants.js → constants.js} +1 -1
- package/constants.js.map +1 -0
- package/domain/permissionsSchema.d.ts +20 -0
- package/domain/permissionsSchema.js +23 -0
- package/domain/permissionsSchema.js.map +1 -0
- package/features/permissions/abstractions.d.ts +17 -0
- package/features/permissions/abstractions.js +5 -0
- package/features/permissions/abstractions.js.map +1 -0
- package/features/permissions/feature.d.ts +14 -0
- package/features/permissions/feature.js +6 -0
- package/features/permissions/feature.js.map +1 -0
- package/index.d.ts +1 -2
- package/index.js +1 -81
- package/index.js.map +1 -1
- package/package.json +20 -26
- package/routes.d.ts +21 -0
- package/routes.js +41 -0
- package/routes.js.map +1 -0
- package/types.d.ts +5 -4
- package/types.js.map +1 -1
- package/ui/views/ApiKeys/ApiKeyForm.d.ts +5 -3
- package/ui/views/ApiKeys/ApiKeyForm.js +130 -79
- package/ui/views/ApiKeys/ApiKeyForm.js.map +1 -1
- package/ui/views/ApiKeys/ApiKeys.d.ts +1 -7
- package/ui/views/ApiKeys/ApiKeys.js +14 -8
- package/ui/views/ApiKeys/ApiKeys.js.map +1 -1
- package/ui/views/ApiKeys/ApiKeysDataList.d.ts +2 -2
- package/ui/views/ApiKeys/ApiKeysDataList.js +52 -42
- package/ui/views/ApiKeys/ApiKeysDataList.js.map +1 -1
- package/ui/views/ApiKeys/graphql.d.ts +1 -1
- package/ui/views/ApiKeys/graphql.js +1 -0
- package/ui/views/ApiKeys/graphql.js.map +1 -1
- package/ui/views/ApiKeys/index.d.ts +1 -1
- package/ui/views/ApiKeys/index.js +1 -1
- package/ui/views/ApiKeys/index.js.map +1 -1
- package/ui/views/ApiKeys/utils.d.ts +3 -2
- package/ui/views/ApiKeys/utils.js +7 -4
- package/ui/views/ApiKeys/utils.js.map +1 -1
- package/ui/views/Roles/Roles.d.ts +2 -0
- package/ui/views/Roles/Roles.js +18 -0
- package/ui/views/Roles/Roles.js.map +1 -0
- package/ui/views/Roles/RolesDataList.d.ts +5 -0
- package/ui/views/{Groups/GroupsDataList.js → Roles/RolesDataList.js} +54 -47
- package/ui/views/Roles/RolesDataList.js.map +1 -0
- package/ui/views/Roles/RolesForm.d.ts +6 -0
- package/ui/views/Roles/RolesForm.js +238 -0
- package/ui/views/Roles/RolesForm.js.map +1 -0
- package/ui/views/Roles/graphql.d.ts +13 -0
- package/ui/views/{Groups → Roles}/graphql.js +15 -15
- package/ui/views/Roles/graphql.js.map +1 -0
- package/ui/views/Roles/index.d.ts +1 -0
- package/ui/views/Roles/index.js +3 -0
- package/ui/views/Roles/index.js.map +1 -0
- package/ui/views/Teams/Teams.d.ts +1 -7
- package/ui/views/Teams/Teams.js +14 -8
- package/ui/views/Teams/Teams.js.map +1 -1
- package/ui/views/Teams/TeamsDataList.d.ts +2 -2
- package/ui/views/Teams/TeamsDataList.js +41 -34
- package/ui/views/Teams/TeamsDataList.js.map +1 -1
- package/ui/views/Teams/TeamsForm.d.ts +3 -2
- package/ui/views/Teams/TeamsForm.js +103 -77
- package/ui/views/Teams/TeamsForm.js.map +1 -1
- package/ui/views/Teams/graphql.d.ts +1 -1
- package/ui/views/Teams/graphql.js +1 -1
- package/ui/views/Teams/graphql.js.map +1 -1
- package/ui/views/Teams/index.d.ts +1 -1
- package/ui/views/Teams/index.js +1 -1
- package/ui/views/Teams/index.js.map +1 -1
- package/components/GroupAutocomplete/graphql.d.ts +0 -1
- package/components/GroupAutocomplete/graphql.js +0 -18
- package/components/GroupAutocomplete/graphql.js.map +0 -1
- package/components/GroupAutocomplete/index.d.ts +0 -5
- package/components/GroupAutocomplete/index.js +0 -18
- package/components/GroupAutocomplete/index.js.map +0 -1
- package/components/GroupsMultiAutocomplete/graphql.d.ts +0 -1
- package/components/GroupsMultiAutocomplete/graphql.js +0 -23
- package/components/GroupsMultiAutocomplete/graphql.js.map +0 -1
- package/components/GroupsMultiAutocomplete/index.d.ts +0 -5
- package/components/GroupsMultiAutocomplete/index.js +0 -19
- package/components/GroupsMultiAutocomplete/index.js.map +0 -1
- package/components/NotAuthorizedError/NotAuthorizedError.d.ts +0 -2
- package/components/NotAuthorizedError/NotAuthorizedError.js +0 -23
- package/components/NotAuthorizedError/NotAuthorizedError.js.map +0 -1
- package/components/NotAuthorizedError/SecureRouteError.svg +0 -1
- package/components/NotAuthorizedError/index.d.ts +0 -1
- package/components/NotAuthorizedError/index.js +0 -3
- package/components/NotAuthorizedError/index.js.map +0 -1
- package/components/TeamAutocomplete/graphql.d.ts +0 -1
- package/components/TeamAutocomplete/graphql.js +0 -18
- package/components/TeamAutocomplete/graphql.js.map +0 -1
- package/components/TeamAutocomplete/index.d.ts +0 -5
- package/components/TeamAutocomplete/index.js +0 -18
- package/components/TeamAutocomplete/index.js.map +0 -1
- package/components/TeamsMultiAutocomplete/graphql.d.ts +0 -1
- package/components/TeamsMultiAutocomplete/graphql.js +0 -23
- package/components/TeamsMultiAutocomplete/graphql.js.map +0 -1
- package/components/TeamsMultiAutocomplete/index.d.ts +0 -5
- package/components/TeamsMultiAutocomplete/index.js +0 -19
- package/components/TeamsMultiAutocomplete/index.js.map +0 -1
- package/plugins/constants.js.map +0 -1
- package/plugins/index.d.ts +0 -3
- package/plugins/index.js +0 -6
- package/plugins/index.js.map +0 -1
- package/plugins/installation.d.ts +0 -3
- package/plugins/installation.js +0 -100
- package/plugins/installation.js.map +0 -1
- package/plugins/permissionRenderer/SecurityPermissions.d.ts +0 -8
- package/plugins/permissionRenderer/SecurityPermissions.js +0 -175
- package/plugins/permissionRenderer/SecurityPermissions.js.map +0 -1
- package/plugins/permissionRenderer/index.d.ts +0 -3
- package/plugins/permissionRenderer/index.js +0 -22
- package/plugins/permissionRenderer/index.js.map +0 -1
- package/plugins/routes.d.ts +0 -3
- package/plugins/routes.js +0 -36
- package/plugins/routes.js.map +0 -1
- package/plugins/secureRouteError.d.ts +0 -7
- package/plugins/secureRouteError.js +0 -12
- package/plugins/secureRouteError.js.map +0 -1
- package/ui/elements/GroupAutocompleteElement.d.ts +0 -6
- package/ui/elements/GroupAutocompleteElement.js +0 -32
- package/ui/elements/GroupAutocompleteElement.js.map +0 -1
- package/ui/elements/GroupsMultiAutocompleteElement.d.ts +0 -6
- package/ui/elements/GroupsMultiAutocompleteElement.js +0 -32
- package/ui/elements/GroupsMultiAutocompleteElement.js.map +0 -1
- package/ui/elements/TeamAutocompleteElement.d.ts +0 -6
- package/ui/elements/TeamAutocompleteElement.js +0 -32
- package/ui/elements/TeamAutocompleteElement.js.map +0 -1
- package/ui/views/Groups/Groups.d.ts +0 -8
- package/ui/views/Groups/Groups.js +0 -12
- package/ui/views/Groups/Groups.js.map +0 -1
- package/ui/views/Groups/GroupsDataList.d.ts +0 -5
- package/ui/views/Groups/GroupsDataList.js.map +0 -1
- package/ui/views/Groups/GroupsForm.d.ts +0 -5
- package/ui/views/Groups/GroupsForm.js +0 -197
- package/ui/views/Groups/GroupsForm.js.map +0 -1
- package/ui/views/Groups/graphql.d.ts +0 -13
- package/ui/views/Groups/graphql.js.map +0 -1
- package/ui/views/Groups/index.d.ts +0 -1
- package/ui/views/Groups/index.js +0 -3
- package/ui/views/Groups/index.js.map +0 -1
package/Extension.d.ts
ADDED
package/Extension.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React, { Fragment, memo } from "react";
|
|
2
|
+
import { useRouter, AdminConfig, AdminLayout, Wcp, RegisterFeature } from "@webiny/app-admin";
|
|
3
|
+
import { HasPermission } from "@webiny/app-admin";
|
|
4
|
+
import { Permission } from "./constants.js";
|
|
5
|
+
import { Roles } from "./ui/views/Roles/index.js";
|
|
6
|
+
import { Teams } from "./ui/views/Teams/index.js";
|
|
7
|
+
import { ApiKeys } from "./ui/views/ApiKeys/index.js";
|
|
8
|
+
import { Routes } from "./routes.js";
|
|
9
|
+
import { SecurityPermissions } from "./SecurityPermissions.js";
|
|
10
|
+
import { SecurityPermissionsFeature } from "./features/permissions/feature.js";
|
|
11
|
+
const {
|
|
12
|
+
Menu,
|
|
13
|
+
Route
|
|
14
|
+
} = AdminConfig;
|
|
15
|
+
const AccessManagementExtension = () => {
|
|
16
|
+
const router = useRouter();
|
|
17
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(RegisterFeature, {
|
|
18
|
+
feature: SecurityPermissionsFeature
|
|
19
|
+
}), /*#__PURE__*/React.createElement(SecurityPermissions, null), /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(HasPermission, {
|
|
20
|
+
name: Permission.Roles
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Route, {
|
|
22
|
+
route: Routes.Roles.List,
|
|
23
|
+
element: /*#__PURE__*/React.createElement(AdminLayout, {
|
|
24
|
+
title: "Access Management - Roles"
|
|
25
|
+
}, /*#__PURE__*/React.createElement(Roles, null))
|
|
26
|
+
})), /*#__PURE__*/React.createElement(Wcp.CanUseTeams, null, /*#__PURE__*/React.createElement(HasPermission, {
|
|
27
|
+
name: Permission.Teams
|
|
28
|
+
}, /*#__PURE__*/React.createElement(Route, {
|
|
29
|
+
route: Routes.Teams.List,
|
|
30
|
+
element: /*#__PURE__*/React.createElement(AdminLayout, {
|
|
31
|
+
title: "Access Management - Teams"
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Teams, null))
|
|
33
|
+
}))), /*#__PURE__*/React.createElement(HasPermission, {
|
|
34
|
+
name: Permission.ApiKeys
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Route, {
|
|
36
|
+
route: Routes.ApiKeys.List,
|
|
37
|
+
element: /*#__PURE__*/React.createElement(AdminLayout, {
|
|
38
|
+
title: "Access Management - API Keys"
|
|
39
|
+
}, /*#__PURE__*/React.createElement(ApiKeys, null))
|
|
40
|
+
})), /*#__PURE__*/React.createElement(HasPermission, {
|
|
41
|
+
any: [Permission.Roles, Permission.ApiKeys, Permission.Teams]
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Menu, {
|
|
43
|
+
name: "settings.security",
|
|
44
|
+
parent: "settings",
|
|
45
|
+
element: /*#__PURE__*/React.createElement(Menu.Group, {
|
|
46
|
+
text: "Access Management",
|
|
47
|
+
collapsible: false
|
|
48
|
+
})
|
|
49
|
+
})), /*#__PURE__*/React.createElement(HasPermission, {
|
|
50
|
+
name: Permission.Roles
|
|
51
|
+
}, /*#__PURE__*/React.createElement(Menu, {
|
|
52
|
+
name: "security.roles",
|
|
53
|
+
parent: "settings.security",
|
|
54
|
+
element: /*#__PURE__*/React.createElement(Menu.Link, {
|
|
55
|
+
text: "Roles",
|
|
56
|
+
to: router.getLink(Routes.Roles.List),
|
|
57
|
+
pinnable: true
|
|
58
|
+
})
|
|
59
|
+
})), /*#__PURE__*/React.createElement(Wcp.CanUseTeams, null, /*#__PURE__*/React.createElement(HasPermission, {
|
|
60
|
+
name: Permission.Teams
|
|
61
|
+
}, /*#__PURE__*/React.createElement(Menu, {
|
|
62
|
+
name: "security.teams",
|
|
63
|
+
parent: "settings.security",
|
|
64
|
+
element: /*#__PURE__*/React.createElement(Menu.Link, {
|
|
65
|
+
text: "Teams",
|
|
66
|
+
to: router.getLink(Routes.Teams.List),
|
|
67
|
+
pinnable: true
|
|
68
|
+
})
|
|
69
|
+
}))), /*#__PURE__*/React.createElement(HasPermission, {
|
|
70
|
+
name: Permission.ApiKeys
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Menu, {
|
|
72
|
+
name: "security.apiKeys",
|
|
73
|
+
parent: "settings.security",
|
|
74
|
+
element: /*#__PURE__*/React.createElement(Menu.Link, {
|
|
75
|
+
text: "API Keys",
|
|
76
|
+
to: router.getLink(Routes.ApiKeys.List),
|
|
77
|
+
pinnable: true
|
|
78
|
+
})
|
|
79
|
+
}))));
|
|
80
|
+
};
|
|
81
|
+
export const AccessManagement = /*#__PURE__*/memo(AccessManagementExtension);
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=Extension.js.map
|
package/Extension.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Fragment","memo","useRouter","AdminConfig","AdminLayout","Wcp","RegisterFeature","HasPermission","Permission","Roles","Teams","ApiKeys","Routes","SecurityPermissions","SecurityPermissionsFeature","Menu","Route","AccessManagementExtension","router","createElement","feature","name","route","List","element","title","CanUseTeams","any","parent","Group","text","collapsible","Link","to","getLink","pinnable","AccessManagement"],"sources":["Extension.tsx"],"sourcesContent":["import React, { Fragment, memo } from \"react\";\nimport { useRouter, AdminConfig, AdminLayout, Wcp, RegisterFeature } from \"@webiny/app-admin\";\nimport { HasPermission } from \"@webiny/app-admin\";\nimport { Permission } from \"~/constants.js\";\nimport { Roles } from \"~/ui/views/Roles/index.js\";\nimport { Teams } from \"~/ui/views/Teams/index.js\";\nimport { ApiKeys } from \"~/ui/views/ApiKeys/index.js\";\nimport { Routes } from \"~/routes.js\";\nimport { SecurityPermissions } from \"./SecurityPermissions.js\";\nimport { SecurityPermissionsFeature } from \"~/features/permissions/feature.js\";\n\nconst { Menu, Route } = AdminConfig;\n\nconst AccessManagementExtension = () => {\n const router = useRouter();\n\n return (\n <Fragment>\n <RegisterFeature feature={SecurityPermissionsFeature} />\n <SecurityPermissions />\n <AdminConfig>\n <HasPermission name={Permission.Roles}>\n <Route\n route={Routes.Roles.List}\n element={\n <AdminLayout title={\"Access Management - Roles\"}>\n <Roles />\n </AdminLayout>\n }\n />\n </HasPermission>\n <Wcp.CanUseTeams>\n <HasPermission name={Permission.Teams}>\n <Route\n route={Routes.Teams.List}\n element={\n <AdminLayout title={\"Access Management - Teams\"}>\n <Teams />\n </AdminLayout>\n }\n />\n </HasPermission>\n </Wcp.CanUseTeams>\n <HasPermission name={Permission.ApiKeys}>\n <Route\n route={Routes.ApiKeys.List}\n element={\n <AdminLayout title={\"Access Management - API Keys\"}>\n <ApiKeys />\n </AdminLayout>\n }\n />\n </HasPermission>\n\n <HasPermission any={[Permission.Roles, Permission.ApiKeys, Permission.Teams]}>\n <Menu\n name={\"settings.security\"}\n parent={\"settings\"}\n element={<Menu.Group text={\"Access Management\"} collapsible={false} />}\n />\n </HasPermission>\n <HasPermission name={Permission.Roles}>\n <Menu\n name={\"security.roles\"}\n parent={\"settings.security\"}\n element={\n <Menu.Link\n text={\"Roles\"}\n to={router.getLink(Routes.Roles.List)}\n pinnable={true}\n />\n }\n />\n </HasPermission>\n <Wcp.CanUseTeams>\n <HasPermission name={Permission.Teams}>\n <Menu\n name={\"security.teams\"}\n parent={\"settings.security\"}\n element={\n <Menu.Link\n text={\"Teams\"}\n to={router.getLink(Routes.Teams.List)}\n pinnable={true}\n />\n }\n />\n </HasPermission>\n </Wcp.CanUseTeams>\n\n <HasPermission name={Permission.ApiKeys}>\n <Menu\n name={\"security.apiKeys\"}\n parent={\"settings.security\"}\n element={\n <Menu.Link\n text={\"API Keys\"}\n to={router.getLink(Routes.ApiKeys.List)}\n pinnable={true}\n />\n }\n />\n </HasPermission>\n </AdminConfig>\n </Fragment>\n );\n};\n\nexport const AccessManagement = memo(AccessManagementExtension);\n"],"mappings":"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","ignoreList":[]}
|
package/README.md
CHANGED
|
@@ -1,117 +1,11 @@
|
|
|
1
|
-
# @webiny/app-security
|
|
2
|
-
[](https://www.npmjs.com/package/@webiny/app-security)
|
|
3
|
-
[](https://www.npmjs.com/package/@webiny/app-security)
|
|
4
|
-
[](https://github.com/prettier/prettier)
|
|
5
|
-
[](http://makeapullrequest.com)
|
|
1
|
+
# @webiny/app-security-access-management
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This package is part of the [Webiny](https://www.webiny.com) monorepo.
|
|
5
|
+
> It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
```
|
|
11
|
-
npm install --save @webiny/app-security
|
|
12
|
-
```
|
|
7
|
+
📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
yarn add @webiny/app-security
|
|
17
|
-
```
|
|
9
|
+
---
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
First, make sure you mount the `SecurityProvider` React provider component in your application's entrypoint component, for example the `App` component:
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
import React from "react";
|
|
25
|
-
import { Routes } from "@webiny/app/components/Routes";
|
|
26
|
-
import { BrowserRouter } from "@webiny/react-router";
|
|
27
|
-
import { SecurityProvider } from "@webiny/app-security";
|
|
28
|
-
import Authenticator from "./components/Authenticator";
|
|
29
|
-
|
|
30
|
-
export const App = () => (
|
|
31
|
-
<>
|
|
32
|
-
{/*
|
|
33
|
-
<SecurityProvider> is a generic provider of identity information. 3rd party identity providers (like Cognito,
|
|
34
|
-
Okta, Auth0) will handle the authentication, and set the information about the user into this provider,
|
|
35
|
-
so other parts of the system have a centralized place to fetch user information from.
|
|
36
|
-
*/}
|
|
37
|
-
<SecurityProvider>
|
|
38
|
-
{/* This is the component that might trigger the initial authentication
|
|
39
|
-
process and set the retrieved user data into the Security provider.*/}
|
|
40
|
-
<Authenticator>
|
|
41
|
-
<BrowserRouter basename={process.env.PUBLIC_URL}>
|
|
42
|
-
<Routes />
|
|
43
|
-
</BrowserRouter>
|
|
44
|
-
</Authenticator>
|
|
45
|
-
</SecurityProvider>
|
|
46
|
-
</>
|
|
47
|
-
);
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
A simple `Authenticator` React component (uses Amazon Cognito and AWS Amplify's [`Auth`](https://github.com/aws-amplify/amplify-js/blob/main/packages/auth/src/Auth.ts#L100) class):
|
|
51
|
-
|
|
52
|
-
```tsx
|
|
53
|
-
import React, { useEffect } from "react";
|
|
54
|
-
import { Auth } from "@aws-amplify/auth";
|
|
55
|
-
import { useSecurity, SecurityIdentity } from "@webiny/app-security";
|
|
56
|
-
|
|
57
|
-
// Apart from the React component, we also configure the Auth class here.
|
|
58
|
-
Auth.configure({
|
|
59
|
-
region: process.env.REACT_APP_USER_POOL_REGION,
|
|
60
|
-
userPoolId: process.env.REACT_APP_USER_POOL_ID,
|
|
61
|
-
userPoolWebClientId: process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID,
|
|
62
|
-
oauth: {
|
|
63
|
-
domain: process.env.REACT_APP_USER_POOL_DOMAIN,
|
|
64
|
-
redirectSignIn: `${location.origin}?signIn`,
|
|
65
|
-
redirectSignOut: `${location.origin}?signOut`,
|
|
66
|
-
responseType: "token"
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
interface AuthenticatorProps {
|
|
70
|
-
children: React.ReactNode;
|
|
71
|
-
}
|
|
72
|
-
// The `Authenticator` component.
|
|
73
|
-
const Authenticator = (props: AuthenticatorProps) => {
|
|
74
|
-
const { setIdentity } = useSecurity();
|
|
75
|
-
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
// Get the currently signed-in user.
|
|
78
|
-
Auth.currentSession().then(response => {
|
|
79
|
-
const user = response.getIdToken().payload;
|
|
80
|
-
setIdentity(
|
|
81
|
-
new SecurityIdentity({
|
|
82
|
-
login: user.email,
|
|
83
|
-
firstName: user.given_name,
|
|
84
|
-
lastName: user.family_name,
|
|
85
|
-
logout: () => {
|
|
86
|
-
Auth.signOut();
|
|
87
|
-
setIdentity(null);
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
);
|
|
91
|
-
}).catch(() => { /* Do nothing. */ });
|
|
92
|
-
}, []);
|
|
93
|
-
|
|
94
|
-
return <>{props.children}</>;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export default Authenticator;
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Finally, use the `useSecurity` React hook in any of your components:
|
|
101
|
-
|
|
102
|
-
```tsx
|
|
103
|
-
import React from "react";
|
|
104
|
-
import { useSecurity } from "@webiny/app-security";
|
|
105
|
-
|
|
106
|
-
const MyComponent = () => {
|
|
107
|
-
const { identity } = useSecurity();
|
|
108
|
-
|
|
109
|
-
if (identity) {
|
|
110
|
-
return <>Logged in.</>;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return <>Not logged in.</>;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export default MyComponent;
|
|
117
|
-
```
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { AdminConfig, useWcp } from "@webiny/app-admin";
|
|
3
|
+
import { ReactComponent as PermissionsIcon } from "@webiny/icons/security.svg";
|
|
4
|
+
const {
|
|
5
|
+
Security
|
|
6
|
+
} = AdminConfig;
|
|
7
|
+
export const SecurityPermissions = () => {
|
|
8
|
+
const wcp = useWcp();
|
|
9
|
+
const teams = wcp.canUseTeams();
|
|
10
|
+
const schema = useMemo(() => {
|
|
11
|
+
const entities = [{
|
|
12
|
+
id: "apiKey",
|
|
13
|
+
title: "API Keys",
|
|
14
|
+
permission: "security.apiKey",
|
|
15
|
+
scopes: ["full"]
|
|
16
|
+
}, {
|
|
17
|
+
id: "group",
|
|
18
|
+
title: "Roles",
|
|
19
|
+
permission: "security.group",
|
|
20
|
+
scopes: ["full"]
|
|
21
|
+
}];
|
|
22
|
+
if (teams) {
|
|
23
|
+
entities.push({
|
|
24
|
+
id: "team",
|
|
25
|
+
title: "Teams",
|
|
26
|
+
permission: "security.team",
|
|
27
|
+
scopes: ["full"]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
prefix: "security",
|
|
32
|
+
fullAccess: true,
|
|
33
|
+
entities
|
|
34
|
+
};
|
|
35
|
+
}, [teams]);
|
|
36
|
+
return /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(Security.Permissions, {
|
|
37
|
+
name: "security",
|
|
38
|
+
title: "Security",
|
|
39
|
+
description: "Manage Security permissions.",
|
|
40
|
+
icon: /*#__PURE__*/React.createElement(PermissionsIcon, null),
|
|
41
|
+
schema: schema
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=SecurityPermissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","AdminConfig","useWcp","ReactComponent","PermissionsIcon","Security","SecurityPermissions","wcp","teams","canUseTeams","schema","entities","id","title","permission","scopes","push","prefix","fullAccess","createElement","Permissions","name","description","icon"],"sources":["SecurityPermissions.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { AdminConfig, useWcp } from \"@webiny/app-admin\";\nimport type { EntityDefinition } from \"@webiny/app-admin\";\nimport { ReactComponent as PermissionsIcon } from \"@webiny/icons/security.svg\";\n\nconst { Security } = AdminConfig;\n\nexport const SecurityPermissions = () => {\n const wcp = useWcp();\n const teams = wcp.canUseTeams();\n\n const schema = useMemo(() => {\n const entities: EntityDefinition[] = [\n {\n id: \"apiKey\",\n title: \"API Keys\",\n permission: \"security.apiKey\",\n scopes: [\"full\"]\n },\n {\n id: \"group\",\n title: \"Roles\",\n permission: \"security.group\",\n scopes: [\"full\"]\n }\n ];\n\n if (teams) {\n entities.push({\n id: \"team\",\n title: \"Teams\",\n permission: \"security.team\",\n scopes: [\"full\"]\n });\n }\n\n return {\n prefix: \"security\",\n fullAccess: true,\n entities\n };\n }, [teams]);\n\n return (\n <AdminConfig>\n <Security.Permissions\n name=\"security\"\n title=\"Security\"\n description=\"Manage Security permissions.\"\n icon={<PermissionsIcon />}\n schema={schema}\n />\n </AdminConfig>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,WAAW,EAAEC,MAAM,QAAQ,mBAAmB;AAEvD,SAASC,cAAc,IAAIC,eAAe,QAAQ,4BAA4B;AAE9E,MAAM;EAAEC;AAAS,CAAC,GAAGJ,WAAW;AAEhC,OAAO,MAAMK,mBAAmB,GAAGA,CAAA,KAAM;EACrC,MAAMC,GAAG,GAAGL,MAAM,CAAC,CAAC;EACpB,MAAMM,KAAK,GAAGD,GAAG,CAACE,WAAW,CAAC,CAAC;EAE/B,MAAMC,MAAM,GAAGV,OAAO,CAAC,MAAM;IACzB,MAAMW,QAA4B,GAAG,CACjC;MACIC,EAAE,EAAE,QAAQ;MACZC,KAAK,EAAE,UAAU;MACjBC,UAAU,EAAE,iBAAiB;MAC7BC,MAAM,EAAE,CAAC,MAAM;IACnB,CAAC,EACD;MACIH,EAAE,EAAE,OAAO;MACXC,KAAK,EAAE,OAAO;MACdC,UAAU,EAAE,gBAAgB;MAC5BC,MAAM,EAAE,CAAC,MAAM;IACnB,CAAC,CACJ;IAED,IAAIP,KAAK,EAAE;MACPG,QAAQ,CAACK,IAAI,CAAC;QACVJ,EAAE,EAAE,MAAM;QACVC,KAAK,EAAE,OAAO;QACdC,UAAU,EAAE,eAAe;QAC3BC,MAAM,EAAE,CAAC,MAAM;MACnB,CAAC,CAAC;IACN;IAEA,OAAO;MACHE,MAAM,EAAE,UAAU;MAClBC,UAAU,EAAE,IAAI;MAChBP;IACJ,CAAC;EACL,CAAC,EAAE,CAACH,KAAK,CAAC,CAAC;EAEX,oBACIT,KAAA,CAAAoB,aAAA,CAAClB,WAAW,qBACRF,KAAA,CAAAoB,aAAA,CAACd,QAAQ,CAACe,WAAW;IACjBC,IAAI,EAAC,UAAU;IACfR,KAAK,EAAC,UAAU;IAChBS,WAAW,EAAC,8BAA8B;IAC1CC,IAAI,eAAExB,KAAA,CAAAoB,aAAA,CAACf,eAAe,MAAE,CAAE;IAC1BM,MAAM,EAAEA;EAAO,CAClB,CACQ,CAAC;AAEtB,CAAC","ignoreList":[]}
|
package/constants.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Permission"],"sources":["constants.ts"],"sourcesContent":["export enum Permission {\n Roles = \"security.role\",\n Teams = \"security.team\",\n ApiKeys = \"security.apiKey\"\n}\n"],"mappings":"AAAA,WAAYA,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const SECURITY_PERMISSIONS_SCHEMA: {
|
|
2
|
+
readonly prefix: "security";
|
|
3
|
+
readonly fullAccess: true;
|
|
4
|
+
readonly entities: [{
|
|
5
|
+
readonly id: "apiKey";
|
|
6
|
+
readonly title: "API Keys";
|
|
7
|
+
readonly permission: "security.apiKey";
|
|
8
|
+
readonly scopes: ["full"];
|
|
9
|
+
}, {
|
|
10
|
+
readonly id: "group";
|
|
11
|
+
readonly title: "Roles";
|
|
12
|
+
readonly permission: "security.group";
|
|
13
|
+
readonly scopes: ["full"];
|
|
14
|
+
}, {
|
|
15
|
+
readonly id: "team";
|
|
16
|
+
readonly title: "Teams";
|
|
17
|
+
readonly permission: "security.team";
|
|
18
|
+
readonly scopes: ["full"];
|
|
19
|
+
}];
|
|
20
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createPermissionSchema } from "@webiny/app-admin";
|
|
2
|
+
export const SECURITY_PERMISSIONS_SCHEMA = createPermissionSchema({
|
|
3
|
+
prefix: "security",
|
|
4
|
+
fullAccess: true,
|
|
5
|
+
entities: [{
|
|
6
|
+
id: "apiKey",
|
|
7
|
+
title: "API Keys",
|
|
8
|
+
permission: "security.apiKey",
|
|
9
|
+
scopes: ["full"]
|
|
10
|
+
}, {
|
|
11
|
+
id: "group",
|
|
12
|
+
title: "Roles",
|
|
13
|
+
permission: "security.group",
|
|
14
|
+
scopes: ["full"]
|
|
15
|
+
}, {
|
|
16
|
+
id: "team",
|
|
17
|
+
title: "Teams",
|
|
18
|
+
permission: "security.team",
|
|
19
|
+
scopes: ["full"]
|
|
20
|
+
}]
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=permissionsSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createPermissionSchema","SECURITY_PERMISSIONS_SCHEMA","prefix","fullAccess","entities","id","title","permission","scopes"],"sources":["permissionsSchema.ts"],"sourcesContent":["import { createPermissionSchema } from \"@webiny/app-admin\";\n\nexport const SECURITY_PERMISSIONS_SCHEMA = createPermissionSchema({\n prefix: \"security\",\n fullAccess: true,\n entities: [\n {\n id: \"apiKey\",\n title: \"API Keys\",\n permission: \"security.apiKey\",\n scopes: [\"full\"]\n },\n {\n id: \"group\",\n title: \"Roles\",\n permission: \"security.group\",\n scopes: [\"full\"]\n },\n {\n id: \"team\",\n title: \"Teams\",\n permission: \"security.team\",\n scopes: [\"full\"]\n }\n ]\n});\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,mBAAmB;AAE1D,OAAO,MAAMC,2BAA2B,GAAGD,sBAAsB,CAAC;EAC9DE,MAAM,EAAE,UAAU;EAClBC,UAAU,EAAE,IAAI;EAChBC,QAAQ,EAAE,CACN;IACIC,EAAE,EAAE,QAAQ;IACZC,KAAK,EAAE,UAAU;IACjBC,UAAU,EAAE,iBAAiB;IAC7BC,MAAM,EAAE,CAAC,MAAM;EACnB,CAAC,EACD;IACIH,EAAE,EAAE,OAAO;IACXC,KAAK,EAAE,OAAO;IACdC,UAAU,EAAE,gBAAgB;IAC5BC,MAAM,EAAE,CAAC,MAAM;EACnB,CAAC,EACD;IACIH,EAAE,EAAE,MAAM;IACVC,KAAK,EAAE,OAAO;IACdC,UAAU,EAAE,eAAe;IAC3BC,MAAM,EAAE,CAAC,MAAM;EACnB,CAAC;AAET,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Permissions } from "@webiny/app-admin/exports/admin/security.js";
|
|
2
|
+
import { SECURITY_PERMISSIONS_SCHEMA } from "../../domain/permissionsSchema.js";
|
|
3
|
+
export declare const SecurityPermissions: import("@webiny/di").Abstraction<{
|
|
4
|
+
canAccess: (entityId: "team" | "apiKey" | "group") => boolean;
|
|
5
|
+
canAction: (action: string, entityId: "team" | "apiKey" | "group") => boolean;
|
|
6
|
+
} & {
|
|
7
|
+
canRead: (entityId: string) => boolean;
|
|
8
|
+
canCreate: (entityId: string) => boolean;
|
|
9
|
+
canEdit: (entityId: string, item?: import("@webiny/app-admin/permissions").OwnableItem) => boolean;
|
|
10
|
+
canDelete: (entityId: string, item?: import("@webiny/app-admin/permissions").OwnableItem) => boolean;
|
|
11
|
+
} & {
|
|
12
|
+
canPublish: (entityId: string) => boolean;
|
|
13
|
+
canUnpublish: (entityId: string) => boolean;
|
|
14
|
+
}>;
|
|
15
|
+
export declare namespace SecurityPermissions {
|
|
16
|
+
type Interface = Permissions<typeof SECURITY_PERMISSIONS_SCHEMA>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createPermissionsAbstraction } from "@webiny/app-admin/exports/admin/security.js";
|
|
2
|
+
import { SECURITY_PERMISSIONS_SCHEMA } from "../../domain/permissionsSchema.js";
|
|
3
|
+
export const SecurityPermissions = createPermissionsAbstraction(SECURITY_PERMISSIONS_SCHEMA);
|
|
4
|
+
|
|
5
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createPermissionsAbstraction","SECURITY_PERMISSIONS_SCHEMA","SecurityPermissions"],"sources":["abstractions.ts"],"sourcesContent":["import { createPermissionsAbstraction } from \"@webiny/app-admin/exports/admin/security.js\";\nimport type { Permissions } from \"@webiny/app-admin/exports/admin/security.js\";\nimport { SECURITY_PERMISSIONS_SCHEMA } from \"~/domain/permissionsSchema.js\";\n\nexport const SecurityPermissions = createPermissionsAbstraction(SECURITY_PERMISSIONS_SCHEMA);\n\nexport namespace SecurityPermissions {\n export type Interface = Permissions<typeof SECURITY_PERMISSIONS_SCHEMA>;\n}\n"],"mappings":"AAAA,SAASA,4BAA4B,QAAQ,6CAA6C;AAE1F,SAASC,2BAA2B;AAEpC,OAAO,MAAMC,mBAAmB,GAAGF,4BAA4B,CAACC,2BAA2B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const SecurityPermissionsFeature: import("@webiny/feature/admin/createFeature.js").FeatureDefinition<{
|
|
2
|
+
permissions: {
|
|
3
|
+
canAccess: (entityId: "team" | "apiKey" | "group") => boolean;
|
|
4
|
+
canAction: (action: string, entityId: "team" | "apiKey" | "group") => boolean;
|
|
5
|
+
} & {
|
|
6
|
+
canRead: (entityId: string) => boolean;
|
|
7
|
+
canCreate: (entityId: string) => boolean;
|
|
8
|
+
canEdit: (entityId: string, item?: import("@webiny/app-admin/index.js").OwnableItem) => boolean;
|
|
9
|
+
canDelete: (entityId: string, item?: import("@webiny/app-admin/index.js").OwnableItem) => boolean;
|
|
10
|
+
} & {
|
|
11
|
+
canPublish: (entityId: string) => boolean;
|
|
12
|
+
canUnpublish: (entityId: string) => boolean;
|
|
13
|
+
};
|
|
14
|
+
}, []>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createPermissionsFeature } from "@webiny/app-admin/exports/admin/security.js";
|
|
2
|
+
import { SECURITY_PERMISSIONS_SCHEMA } from "../../domain/permissionsSchema.js";
|
|
3
|
+
import { SecurityPermissions } from "./abstractions.js";
|
|
4
|
+
export const SecurityPermissionsFeature = createPermissionsFeature(SECURITY_PERMISSIONS_SCHEMA, SecurityPermissions);
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createPermissionsFeature","SECURITY_PERMISSIONS_SCHEMA","SecurityPermissions","SecurityPermissionsFeature"],"sources":["feature.ts"],"sourcesContent":["import { createPermissionsFeature } from \"@webiny/app-admin/exports/admin/security.js\";\nimport { SECURITY_PERMISSIONS_SCHEMA } from \"~/domain/permissionsSchema.js\";\nimport { SecurityPermissions } from \"./abstractions.js\";\n\nexport const SecurityPermissionsFeature = createPermissionsFeature(\n SECURITY_PERMISSIONS_SCHEMA,\n SecurityPermissions\n);\n"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,6CAA6C;AACtF,SAASC,2BAA2B;AACpC,SAASC,mBAAmB;AAE5B,OAAO,MAAMC,0BAA0B,GAAGH,wBAAwB,CAC9DC,2BAA2B,EAC3BC,mBACJ,CAAC","ignoreList":[]}
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const AccessManagement: React.MemoExoticComponent<() => React.JSX.Element>;
|
|
1
|
+
export { AccessManagement } from "./Extension.js";
|
package/index.js
CHANGED
|
@@ -1,83 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import { plugins } from "@webiny/plugins";
|
|
3
|
-
import { Layout, Wcp } from "@webiny/app-admin";
|
|
4
|
-
import { HasPermission } from "@webiny/app-security";
|
|
5
|
-
import { Permission } from "./plugins/constants";
|
|
6
|
-
import { Groups } from "./ui/views/Groups";
|
|
7
|
-
import { Teams } from "./ui/views/Teams";
|
|
8
|
-
import { ApiKeys } from "./ui/views/ApiKeys";
|
|
9
|
-
import accessManagementPlugins from "./plugins";
|
|
10
|
-
import { AdminConfig } from "@webiny/app-admin";
|
|
11
|
-
const {
|
|
12
|
-
Menu,
|
|
13
|
-
Route
|
|
14
|
-
} = AdminConfig;
|
|
15
|
-
const AccessManagementExtension = () => {
|
|
16
|
-
plugins.register(accessManagementPlugins());
|
|
17
|
-
return /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(HasPermission, {
|
|
18
|
-
name: Permission.Groups
|
|
19
|
-
}, /*#__PURE__*/React.createElement(Route, {
|
|
20
|
-
name: "security.groups",
|
|
21
|
-
exact: true,
|
|
22
|
-
path: "/access-management/roles",
|
|
23
|
-
element: /*#__PURE__*/React.createElement(Layout, {
|
|
24
|
-
title: "Access Management - Roles"
|
|
25
|
-
}, /*#__PURE__*/React.createElement(Groups, null))
|
|
26
|
-
})), /*#__PURE__*/React.createElement(Wcp.CanUseTeams, null, /*#__PURE__*/React.createElement(HasPermission, {
|
|
27
|
-
name: Permission.Teams
|
|
28
|
-
}, /*#__PURE__*/React.createElement(Route, {
|
|
29
|
-
name: "security.teams",
|
|
30
|
-
exact: true,
|
|
31
|
-
path: "/access-management/teams",
|
|
32
|
-
element: /*#__PURE__*/React.createElement(Layout, {
|
|
33
|
-
title: "Access Management - Teams"
|
|
34
|
-
}, /*#__PURE__*/React.createElement(Teams, null))
|
|
35
|
-
}))), /*#__PURE__*/React.createElement(HasPermission, {
|
|
36
|
-
name: Permission.ApiKeys
|
|
37
|
-
}, /*#__PURE__*/React.createElement(Route, {
|
|
38
|
-
name: "security.apiKeys",
|
|
39
|
-
exact: true,
|
|
40
|
-
path: "/access-management/api-keys",
|
|
41
|
-
element: /*#__PURE__*/React.createElement(Layout, {
|
|
42
|
-
title: "Access Management - API Keys"
|
|
43
|
-
}, /*#__PURE__*/React.createElement(ApiKeys, null))
|
|
44
|
-
})), /*#__PURE__*/React.createElement(HasPermission, {
|
|
45
|
-
any: [Permission.Groups, Permission.ApiKeys, Permission.Teams]
|
|
46
|
-
}, /*#__PURE__*/React.createElement(Menu, {
|
|
47
|
-
name: "security.settings",
|
|
48
|
-
parent: "settings",
|
|
49
|
-
element: /*#__PURE__*/React.createElement(Menu.Group, {
|
|
50
|
-
text: "Access Management"
|
|
51
|
-
})
|
|
52
|
-
})), /*#__PURE__*/React.createElement(HasPermission, {
|
|
53
|
-
name: Permission.Groups
|
|
54
|
-
}, /*#__PURE__*/React.createElement(Menu, {
|
|
55
|
-
name: "security.roles",
|
|
56
|
-
parent: "settings",
|
|
57
|
-
element: /*#__PURE__*/React.createElement(Menu.Link, {
|
|
58
|
-
text: "Roles",
|
|
59
|
-
to: "/access-management/roles"
|
|
60
|
-
})
|
|
61
|
-
})), /*#__PURE__*/React.createElement(Wcp.CanUseTeams, null, /*#__PURE__*/React.createElement(HasPermission, {
|
|
62
|
-
name: Permission.Teams
|
|
63
|
-
}, /*#__PURE__*/React.createElement(Menu, {
|
|
64
|
-
name: "security.teams",
|
|
65
|
-
parent: "settings",
|
|
66
|
-
element: /*#__PURE__*/React.createElement(Menu.Link, {
|
|
67
|
-
text: "Teams",
|
|
68
|
-
to: "/access-management/teams"
|
|
69
|
-
})
|
|
70
|
-
}))), /*#__PURE__*/React.createElement(HasPermission, {
|
|
71
|
-
name: Permission.ApiKeys
|
|
72
|
-
}, /*#__PURE__*/React.createElement(Menu, {
|
|
73
|
-
name: "security.apiKeys",
|
|
74
|
-
parent: "settings",
|
|
75
|
-
element: /*#__PURE__*/React.createElement(Menu.Link, {
|
|
76
|
-
text: "API Keys",
|
|
77
|
-
to: "/access-management/api-keys"
|
|
78
|
-
})
|
|
79
|
-
})));
|
|
80
|
-
};
|
|
81
|
-
export const AccessManagement = /*#__PURE__*/memo(AccessManagementExtension);
|
|
1
|
+
export { AccessManagement } from "./Extension.js";
|
|
82
2
|
|
|
83
3
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["AccessManagement"],"sources":["index.tsx"],"sourcesContent":["export { AccessManagement } from \"./Extension.js\";\n"],"mappings":"AAAA,SAASA,gBAAgB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-security-access-management",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.0.0-unstable.e6f0dc8ca7",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.js",
|
|
7
|
+
"./*": "./*"
|
|
8
|
+
},
|
|
5
9
|
"repository": {
|
|
6
10
|
"type": "git",
|
|
7
11
|
"url": "https://github.com/webiny/webiny-js.git"
|
|
@@ -14,38 +18,28 @@
|
|
|
14
18
|
"license": "MIT",
|
|
15
19
|
"dependencies": {
|
|
16
20
|
"@apollo/react-hooks": "3.1.5",
|
|
17
|
-
"@
|
|
18
|
-
"@webiny/
|
|
19
|
-
"@webiny/app": "0.0.0-unstable.
|
|
20
|
-
"@webiny/
|
|
21
|
-
"@webiny/
|
|
22
|
-
"@webiny/
|
|
23
|
-
"@webiny/icons": "0.0.0-unstable.e53eceafb5",
|
|
24
|
-
"@webiny/plugins": "0.0.0-unstable.e53eceafb5",
|
|
25
|
-
"@webiny/react-router": "0.0.0-unstable.e53eceafb5",
|
|
26
|
-
"@webiny/ui": "0.0.0-unstable.e53eceafb5",
|
|
27
|
-
"@webiny/validation": "0.0.0-unstable.e53eceafb5",
|
|
21
|
+
"@webiny/admin-ui": "0.0.0-unstable.e6f0dc8ca7",
|
|
22
|
+
"@webiny/app": "0.0.0-unstable.e6f0dc8ca7",
|
|
23
|
+
"@webiny/app-admin": "0.0.0-unstable.e6f0dc8ca7",
|
|
24
|
+
"@webiny/form": "0.0.0-unstable.e6f0dc8ca7",
|
|
25
|
+
"@webiny/icons": "0.0.0-unstable.e6f0dc8ca7",
|
|
26
|
+
"@webiny/validation": "0.0.0-unstable.e6f0dc8ca7",
|
|
28
27
|
"graphql-tag": "2.12.6",
|
|
29
|
-
"lodash": "4.
|
|
30
|
-
"react": "18.
|
|
31
|
-
"react-dom": "18.
|
|
32
|
-
"react-helmet": "6.1.0"
|
|
28
|
+
"lodash": "4.18.1",
|
|
29
|
+
"react": "18.3.1",
|
|
30
|
+
"react-dom": "18.3.1"
|
|
33
31
|
},
|
|
34
32
|
"devDependencies": {
|
|
35
|
-
"@emotion/babel-plugin": "11.
|
|
33
|
+
"@emotion/babel-plugin": "11.13.5",
|
|
36
34
|
"@types/react-helmet": "6.1.11",
|
|
37
|
-
"@webiny/
|
|
38
|
-
"rimraf": "6.
|
|
39
|
-
"typescript": "
|
|
35
|
+
"@webiny/build-tools": "0.0.0-unstable.e6f0dc8ca7",
|
|
36
|
+
"rimraf": "6.1.3",
|
|
37
|
+
"typescript": "6.0.3"
|
|
40
38
|
},
|
|
41
39
|
"publishConfig": {
|
|
42
40
|
"access": "public",
|
|
43
41
|
"directory": "dist"
|
|
44
42
|
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"build": "node ../cli/bin.js run build",
|
|
47
|
-
"watch": "node ../cli/bin.js run watch"
|
|
48
|
-
},
|
|
49
43
|
"adio": {
|
|
50
44
|
"ignore": {
|
|
51
45
|
"peerDependencies": [
|
|
@@ -53,5 +47,5 @@
|
|
|
53
47
|
]
|
|
54
48
|
}
|
|
55
49
|
},
|
|
56
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "e6f0dc8ca741c1fcc3fec9a5b9e86fdd49544641"
|
|
57
51
|
}
|
package/routes.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Route } from "@webiny/app-admin";
|
|
2
|
+
export declare const Routes: {
|
|
3
|
+
Roles: {
|
|
4
|
+
List: Route<{
|
|
5
|
+
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
6
|
+
new: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
Teams: {
|
|
10
|
+
List: Route<{
|
|
11
|
+
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
12
|
+
new: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
ApiKeys: {
|
|
16
|
+
List: Route<{
|
|
17
|
+
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
18
|
+
new: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
};
|