import { Authenticator, PermissionsBuilder, Role, User } from "@firecms/core"; export type UserManagement = { authenticator?: Authenticator; loading: boolean; users: USER[]; saveUser: (user: USER) => Promise; deleteUser: (user: USER) => Promise; roles: Role[]; saveRole: (role: Role) => Promise; deleteRole: (role: Role) => Promise; /** * Is the logged user Admin? */ isAdmin?: boolean; /** * Include a button to create default roles, in case there are no roles in the system. */ allowDefaultRolesCreation?: boolean; /** * Include the collection config permissions in the user management system. */ includeCollectionConfigPermissions?: boolean; /** * Get a permissions builder that defines which operations can be performed by a user in a collection. * The permission builder generated should be based in the user roles and the collection config. */ collectionPermissions: PermissionsBuilder; /** * Define the roles for a given user. You will typically want to plug this into your auth controller. * @param user */ defineRolesFor: (user: User) => Promise | Role[] | undefined; rolesError?: Error; usersError?: Error; /** * Function to get a user by uid. * @param uid */ getUser: (uid: string) => User | null; };