@rebasepro/client-firebase 0.0.1-canary.4d4fb3e → 0.0.1-canary.ca2cb6e

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.
@@ -130,7 +130,7 @@ export type RebaseFirebaseAppProps = {
130
130
  /**
131
131
  * Delegate for user and role management. Provides the admin views if specified.
132
132
  */
133
- userManagement?: UserManagementDelegate;
133
+ userManagement?: UserManagementDelegate<FirebaseUserWrapper>;
134
134
  };
135
135
  export type ComponentsRegistry = {
136
136
  /**
@@ -5,3 +5,4 @@ export * from "./useAppCheck";
5
5
  export * from "./useFirestoreDriver";
6
6
  export * from "./useFirebaseRealTimeDBDelegate";
7
7
  export * from "./useRecaptcha";
8
+ export * from "./useBuildUserManagement";
@@ -17,4 +17,4 @@ export interface InitializeAppCheckResult {
17
17
  *
18
18
  * @group Firebase
19
19
  */
20
- export declare function useAppCheck({ firebaseApp, options, }: InitializeAppCheckProps): InitializeAppCheckResult;
20
+ export declare function useAppCheck({ firebaseApp, options }: InitializeAppCheckProps): InitializeAppCheckResult;
@@ -0,0 +1,46 @@
1
+ import { AuthController, DataDriver, Role, User, UserManagementDelegate } from "@rebasepro/types";
2
+ export interface UserManagementDelegateParams<CONTROLLER extends AuthController<any> = AuthController<any>> {
3
+ authController: CONTROLLER;
4
+ /**
5
+ * The delegate in charge of persisting the data.
6
+ */
7
+ dataSourceDelegate?: DataDriver;
8
+ /**
9
+ * Path where the plugin users configuration is stored.
10
+ * Default: __FIRECMS/config/users
11
+ * You can specify a different path if you want to store the user management configuration in a different place.
12
+ * Please keep in mind that the FireCMS users are not necessarily the same as the Firebase users (but they can be).
13
+ * The path should be relative to the root of the database, and should always have an odd number of segments.
14
+ */
15
+ usersPath?: string;
16
+ /**
17
+ * Path where the plugin roles configuration is stored.
18
+ * Default: __FIRECMS/config/roles
19
+ */
20
+ rolesPath?: string;
21
+ /**
22
+ * The roles that are available in the user management system.
23
+ * If you provide this, the user management system will not fetch the roles from the database.
24
+ */
25
+ roles?: Role[];
26
+ /**
27
+ * If there are no roles in the database, provide a button to create the default roles.
28
+ */
29
+ allowDefaultRolesCreation?: boolean;
30
+ /**
31
+ * Include the collection config permissions in the user management system.
32
+ */
33
+ includeCollectionConfigPermissions?: boolean;
34
+ }
35
+ /**
36
+ * This hook is used to build a user management object that can be used to
37
+ * manage users and roles in a Firestore backend.
38
+ * @param authController
39
+ * @param dataSourceDelegate
40
+ * @param usersPath
41
+ * @param rolesPath
42
+ * @param roles
43
+ * @param allowDefaultRolesCreation
44
+ * @param includeCollectionConfigPermissions
45
+ */
46
+ export declare function useBuildUserManagement<CONTROLLER extends AuthController<any> = AuthController<any>, USER extends User = CONTROLLER extends AuthController<infer U> ? U : any>({ authController, dataSourceDelegate, roles: rolesProp, usersPath, rolesPath, allowDefaultRolesCreation, includeCollectionConfigPermissions }: UserManagementDelegateParams<CONTROLLER>): UserManagementDelegate<USER> & CONTROLLER;