@firecms/user_management 3.0.0-canary.8 → 3.0.0-canary.80

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.
Files changed (43) hide show
  1. package/LICENSE +113 -21
  2. package/dist/UserManagementProvider.d.ts +4 -3
  3. package/dist/components/roles/RoleChip.d.ts +1 -1
  4. package/dist/components/roles/RolesDetailsForm.d.ts +1 -2
  5. package/dist/components/roles/RolesTable.d.ts +1 -1
  6. package/dist/components/roles/default_roles.d.ts +1 -1
  7. package/dist/components/users/UserDetailsForm.d.ts +2 -2
  8. package/dist/components/users/UsersTable.d.ts +2 -2
  9. package/dist/hooks/index.d.ts +1 -1
  10. package/dist/hooks/{useBuildFirestoreUserManagement.d.ts → useFirestoreUserManagement.d.ts} +8 -4
  11. package/dist/hooks/useUserManagement.d.ts +3 -2
  12. package/dist/index.es.js +569 -493
  13. package/dist/index.es.js.map +1 -1
  14. package/dist/index.umd.js +1 -1
  15. package/dist/index.umd.js.map +1 -1
  16. package/dist/types/index.d.ts +1 -2
  17. package/dist/types/persisted_user.d.ts +5 -0
  18. package/dist/types/user_management.d.ts +18 -10
  19. package/dist/useUserManagementPlugin.d.ts +6 -1
  20. package/dist/utils/permissions.d.ts +3 -4
  21. package/package.json +14 -31
  22. package/src/UserManagementProvider.tsx +4 -3
  23. package/src/components/roles/RoleChip.tsx +1 -1
  24. package/src/components/roles/RolesDetailsForm.tsx +1 -2
  25. package/src/components/roles/RolesTable.tsx +1 -2
  26. package/src/components/roles/RolesView.tsx +1 -2
  27. package/src/components/roles/default_roles.tsx +1 -1
  28. package/src/components/users/UserDetailsForm.tsx +14 -13
  29. package/src/components/users/UsersTable.tsx +6 -6
  30. package/src/components/users/UsersView.tsx +3 -3
  31. package/src/hooks/index.ts +1 -1
  32. package/src/hooks/{useBuildFirestoreUserManagement.tsx → useFirestoreUserManagement.tsx} +92 -56
  33. package/src/hooks/useUserManagement.tsx +3 -3
  34. package/src/types/index.ts +1 -2
  35. package/src/types/persisted_user.ts +6 -0
  36. package/src/types/user_management.tsx +22 -11
  37. package/src/useUserManagementPlugin.tsx +89 -3
  38. package/src/utils/permissions.ts +7 -5
  39. package/dist/types/firecms_user.d.ts +0 -7
  40. package/dist/types/roles.d.ts +0 -31
  41. package/src/types/firecms_user.ts +0 -8
  42. package/src/types/roles.ts +0 -41
  43. package/tailwind.config.js +0 -68
package/LICENSE CHANGED
@@ -1,21 +1,113 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 FireCMS
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: Firecms S.L.
6
+ Licensed Work: Firecms CMS packages:
7
+ cli
8
+ collection_editor
9
+ collection_editor_firebase
10
+ data_enhancement
11
+ data_import_export
12
+ editor
13
+ firecms_cloud
14
+ schema_inference
15
+ user_management
16
+
17
+ The Licensed Work is (c) 2024 Firecms S.L
18
+ Additional Use Grant: You may make use of the Licensed Work, provided that
19
+ you may not use the Licensed Work for a CMS Data Enhancement
20
+ Service.
21
+
22
+ A “CMS package” is a commercial offering that
23
+ allows third parties (other than your employees and
24
+ contractors) to access the functionality of the
25
+ Licensed Work by using software to extend the base features of
26
+ content management system controlled by such third parties.
27
+
28
+ Change Date: Four years from the date the Licensed Work is published.
29
+
30
+ Change License: MIT
31
+
32
+ For information about alternative licensing arrangements for the Software,
33
+ please visit: https://firecms.co
34
+
35
+ Notice
36
+
37
+ The Business Source License (this document, or the “License”) is not an Open
38
+ Source license. However, the Licensed Work will eventually be made available
39
+ under an Open Source License, as stated in this License.
40
+
41
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
42
+ “Business Source License” is a trademark of MariaDB Corporation Ab.
43
+
44
+ -----------------------------------------------------------------------------
45
+
46
+ Business Source License 1.1
47
+
48
+ Terms
49
+
50
+ The Licensor hereby grants you the right to copy, modify, create derivative
51
+ works, redistribute, and make non-production use of the Licensed Work. The
52
+ Licensor may make an Additional Use Grant, above, permitting limited
53
+ production use.
54
+
55
+ Effective on the Change Date, or the fourth anniversary of the first publicly
56
+ available distribution of a specific version of the Licensed Work under this
57
+ License, whichever comes first, the Licensor hereby grants you rights under
58
+ the terms of the Change License, and the rights granted in the paragraph
59
+ above terminate.
60
+
61
+ If your use of the Licensed Work does not comply with the requirements
62
+ currently in effect as described in this License, you must purchase a
63
+ commercial license from the Licensor, its affiliated entities, or authorized
64
+ resellers, or you must refrain from using the Licensed Work.
65
+
66
+ All copies of the original and modified Licensed Work, and derivative works
67
+ of the Licensed Work, are subject to this License. This License applies
68
+ separately for each version of the Licensed Work and the Change Date may vary
69
+ for each version of the Licensed Work released by Licensor.
70
+
71
+ You must conspicuously display this License on each original or modified copy
72
+ of the Licensed Work. If you receive the Licensed Work in original or
73
+ modified form from a third party, the terms and conditions set forth in this
74
+ License apply to your use of that work.
75
+
76
+ Any use of the Licensed Work in violation of this License will automatically
77
+ terminate your rights under this License for the current and all other
78
+ versions of the Licensed Work.
79
+
80
+ This License does not grant you any right in any trademark or logo of
81
+ Licensor or its affiliates (provided that you may use a trademark or logo of
82
+ Licensor as expressly required by this License).
83
+
84
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
85
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
86
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
88
+ TITLE.
89
+
90
+ MariaDB hereby grants you permission to use this License’s text to license
91
+ your works, and to refer to it using the trademark “Business Source License”,
92
+ as long as you comply with the Covenants of Licensor below.
93
+
94
+ Covenants of Licensor
95
+
96
+ In consideration of the right to use this License’s text and the “Business
97
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
98
+ other recipients of the licensed work to be provided by Licensor:
99
+
100
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
101
+ or a license that is compatible with GPL Version 2.0 or a later version,
102
+ where “compatible” means that software provided under the Change License can
103
+ be included in a program with software provided under GPL Version 2.0 or a
104
+ later version. Licensor may specify additional Change Licenses without
105
+ limitation.
106
+
107
+ 2. To either: (a) specify an additional grant of rights to use that does not
108
+ impose any additional restriction on the right granted in this License, as
109
+ the Additional Use Grant; or (b) insert the text “None”.
110
+
111
+ 3. To specify a Change Date.
112
+
113
+ 4. Not to modify this License in any other way.
@@ -1,7 +1,8 @@
1
1
  import React, { PropsWithChildren } from "react";
2
- import { UserManagement, UserWithRoles } from "./types";
2
+ import { UserManagement } from "./types";
3
+ import { User } from "@firecms/core";
3
4
  export declare const UserManagementContext: React.Context<UserManagement<any>>;
4
- export interface UserManagementProviderProps<U extends UserWithRoles = UserWithRoles> {
5
+ export interface UserManagementProviderProps<U extends User = User> {
5
6
  userManagement: UserManagement<U>;
6
7
  }
7
- export declare function UserManagementProvider<U extends UserWithRoles = UserWithRoles>({ children, userManagement }: PropsWithChildren<UserManagementProviderProps<U>>): import("react/jsx-runtime").JSX.Element;
8
+ export declare function UserManagementProvider<U extends User = User>({ children, userManagement }: PropsWithChildren<UserManagementProviderProps<U>>): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { Role } from "../../types";
1
+ import { Role } from "@firecms/core";
2
2
  export type RoleChipProps = {
3
3
  role: Role;
4
4
  };
@@ -1,6 +1,5 @@
1
1
  import * as Yup from "yup";
2
- import { EntityCollection } from "@firecms/core";
3
- import { Role } from "../../types";
2
+ import { EntityCollection, Role } from "@firecms/core";
4
3
  export declare const RoleYupSchema: Yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
5
4
  id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
5
  name: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
@@ -1,4 +1,4 @@
1
- import { Role } from "../../types";
1
+ import { Role } from "@firecms/core";
2
2
  export declare function RolesTable({ onRoleClicked, editable }: {
3
3
  onRoleClicked: (role: Role) => void;
4
4
  editable: boolean;
@@ -1,2 +1,2 @@
1
- import { Role } from "../../types";
1
+ import { Role } from "@firecms/core";
2
2
  export declare const DEFAULT_ROLES: Role[];
@@ -1,5 +1,5 @@
1
1
  import * as Yup from "yup";
2
- import { UserWithRoles } from "../../types";
2
+ import { User } from "@firecms/core";
3
3
  export declare const UserYupSchema: Yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
4
4
  displayName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
5
5
  email: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
@@ -15,6 +15,6 @@ export declare const UserYupSchema: Yup.ObjectSchema<import("yup/lib/object").As
15
15
  }>>>;
16
16
  export declare function UserDetailsForm({ open, user: userProp, handleClose }: {
17
17
  open: boolean;
18
- user?: UserWithRoles;
18
+ user?: User;
19
19
  handleClose: () => void;
20
20
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { UserWithRoles } from "../../types";
1
+ import { User } from "@firecms/core";
2
2
  export declare function UsersTable({ onUserClicked }: {
3
- onUserClicked: (user: UserWithRoles) => void;
3
+ onUserClicked: (user: User) => void;
4
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
- export * from "./useBuildFirestoreUserManagement";
1
+ export * from "./useFirestoreUserManagement";
2
2
  export * from "./useUserManagement";
@@ -1,6 +1,5 @@
1
- import { FirebaseApp } from "firebase/app";
1
+ import { FirebaseApp } from "@firebase/app";
2
2
  import { UserManagement } from "../types";
3
- import { AuthController } from "@firecms/core";
4
3
  export interface UserManagementParams {
5
4
  /**
6
5
  * The Firebase app to use for the user management. The config will be saved in the Firestore
@@ -20,9 +19,14 @@ export interface UserManagementParams {
20
19
  * Default: __FIRECMS/config/roles
21
20
  */
22
21
  rolesPath?: string;
22
+ /**
23
+ * Maximum number of users that can be created.
24
+ */
23
25
  usersLimit?: number;
26
+ /**
27
+ * Can the logged user edit roles
28
+ */
24
29
  canEditRoles?: boolean;
25
- authController: AuthController;
26
30
  /**
27
31
  * If there are no roles in the database, provide a button to create the default roles.
28
32
  */
@@ -41,4 +45,4 @@ export interface UserManagementParams {
41
45
  * @param usersLimit
42
46
  * @param canEditRoles
43
47
  */
44
- export declare function useBuildFirestoreUserManagement({ firebaseApp, usersPath, rolesPath, usersLimit, canEditRoles, authController, allowDefaultRolesCreation, includeCollectionConfigPermissions }: UserManagementParams): UserManagement;
48
+ export declare function useFirestoreUserManagement({ firebaseApp, usersPath, rolesPath, usersLimit, canEditRoles, allowDefaultRolesCreation, includeCollectionConfigPermissions }: UserManagementParams): UserManagement;
@@ -1,2 +1,3 @@
1
- import { UserManagement } from "../types/user_management";
2
- export declare const useUserManagement: () => UserManagement;
1
+ import { UserManagement } from "../types";
2
+ import { User } from "@firecms/core";
3
+ export declare const useUserManagement: <USER extends User>() => UserManagement<USER>;