@opensrp/user-management
TypeScript icon, indicating that this package has built-in type declarations

0.1.19 • Public • Published

Keycloak User Management Module

This package has a set of components that are used to interact with keycloak api. It currently has 3 components

  • UserListView - Shows a list of keycloak users, also allows the admin to create, edit or delete users
  • CreateEditView - A user form to allow admin to update user info
  • Credentials - Allows the admin to set passords to newly created users or update passwords for existing users

Installation

yarn add @opensrp/keycloak-user-management

Code example

import {
  ConnectedUserList,
  ConnectedCreateEditUser,
  ConnectedUserCredentials,
  URL_USER,
  URL_USER_EDIT,
  ROUTE_PARAM_USER_ID,
  URL_USER_CREATE,
  URL_USER_CREDENTIALS,
} from '@opensrp/user-management';

const App = () => {
  return (
    <Layout>
      <Content>
        <Switch>
           <ConnectedPrivateRoute
              redirectPath={APP_CALLBACK_URL}
              disableLoginProtection={DISABLE_LOGIN_PROTECTION}
              exact
              path={URL_USER}
              component={(props: any) => (
                <ConnectedUserList {...props} keycloakBaseURL={KEYCLOAK_API_BASE_URL} />
              )}
            />
            <ConnectedPrivateRoute
              redirectPath={APP_CALLBACK_URL}
              disableLoginProtection={DISABLE_LOGIN_PROTECTION}
              exact
              path={`${URL_USER_EDIT}/:${ROUTE_PARAM_USER_ID}`}
              component={(props: any) => (
                <ConnectedCreateEditUser {...props} keycloakBaseURL={KEYCLOAK_API_BASE_URL} />
              )}
            />
            <ConnectedPrivateRoute
              redirectPath={APP_CALLBACK_URL}
              disableLoginProtection={DISABLE_LOGIN_PROTECTION}
              exact
              path={URL_USER_CREATE}
              component={(props: any) => (
                <ConnectedCreateEditUser {...props} keycloakBaseURL={KEYCLOAK_API_BASE_URL} />
              )}
            />
            <ConnectedPrivateRoute
              redirectPath={APP_CALLBACK_URL}
              disableLoginProtection={DISABLE_LOGIN_PROTECTION}
              exact
              path={`${URL_USER_CREDENTIALS}/:${ROUTE_PARAM_USER_ID}`}
              component={(props: any) => (
                <ConnectedUserCredentials {...props} keycloakBaseURL={KEYCLOAK_API_BASE_URL} />
              )}
            />
        </Switch>
      </Content>
    </Layout>
  );
};

export default App;

Dependencies (23)

Dev Dependencies (2)

Package Sidebar

Install

npm i @opensrp/user-management

Weekly Downloads

2

Version

0.1.19

License

Apache-2.0

Unpacked Size

202 kB

Total Files

61

Last publish

Collaborators

  • opensrp-admin