1.26.3 • Published 11 days ago

identity-admin v1.26.3

Weekly downloads
-
License
ISC
Repository
github
Last release
11 days ago

Identity Admin Dashboard

Build Status

How to install

npm i identity-admin

Features

  • Creating Dashboard with minimal Ui for mongoose models.
  • Provide DashboardController for custom routing and middlewares.
  • Provide multiple dashboard instances with diffrent routes.

Create new unAuthenticated Dashboard:

  • Create new instance from Dashboard.
  • Provide Resources array of resources file.
  • Build the instance after mongoose setup by passing app instance to the build function.
const dashboard: Dashboard = new Dashboard({ resources:[ <Resource: IResourceFile> ]);
dashboard.build(app);

To create new Authenticated Dashboard:

  • Create new instance from Dashboard.
  • Provide Resources array of resources file.
  • Provide authenticate function which take AdminCredentials as parameter and return a promise of boolean or user data.
  • Provide cookiesConfiguration (cookie name and cookie secret).
  • Build the instance after mongoose setup by passing app instance to the build function.
const dashboard = new Dashboard({
        resources: [ UserResource ],
        cookiesConfiguration: {
            cookiesSecret: "cokieieSecret",
            cookieName: "connect.sid"
        },
        authenticate: async (credentials: AdminCredentials) => {
            const user = await Admin.findOne({ email: credentials.email });
            if (user) {
                const matched = await bcrypt.compare(credentials.password, user.encryptedPassword);
                if (matched) {
                    return user;
                }
            }
            return false;
        }
    })
dashboard.build(app);

To create new CustomRoutes Dashboard:

This method require to implement your own view and new react app

  • Create new controller class with invirsify-express-utils notaitions and extend ActionController.
  • Create new controller class with invirsify-express-utils notaitions and extend ResourceController.
  • Create new controller class with invirsify-express-utils notaitions and extend DashboardController.
  • Provide resource file and repository in super constructor.
  • Following class will create new route /v1/contries ***Now you can pass any auth middlewares you want
@controller('/v1/actions', defaultHeaders)
export default class ActionsController extends ActionController{
  
  constructor(
      @inject(TYPES.IResources) private resources: IResourceFile[]) {
      super(resources);
  }
}
@controller('/v1/resources', defaultHeaders)
export default class ResourcesController extends ResourceController{
  
  constructor(
      @inject(TYPES.IResources) private resources: IResourceFile[]) {
      super(resources);
  }
}
@controller('/v1/contries', defaultHeaders)
export default class CountryController extends DashboardController{
  
  constructor(
      @inject(TYPES.ICountryRepository) private countryRepository: CountryRepository,
      @inject(TYPES.ICountryResource) private countryResource: IResourceFile  ) {

      super(CountryResource, countryRepository);
  }
}

Documentaion:

    Dashboard(dashBoardConfig: DashboardConfig);
    build(app: Application): void;

Dashboard:

Dashboard constructor to create new instance from idntity-admin.

  • dashBoardConfig:
    {
      resources: IResourceFile[]; // Array of resources files.
      rootPath?: string; // optional root path default to  /dashboard
      localesOptions?: i18n.ConfigurationOptions; // locales options for custom dashboard
      cookiesConfiguration: CookieConfiguration; // cookies configuration in case of authenticated dashboard
      authenticate?: AuthenticateMiddleWare; // authenticate function used to login the admin.
    }
  • IResourceFile For resource file example check IResourceFile

  • CookieConfiguration

{
  cookiesSecret: string; // cookie secret to handle sessions
  cookieName: string; // cookie name as appeared in browser
}
1.26.3

11 days ago

1.26.2

11 days ago

1.26.1

23 days ago

1.26.0

2 months ago

1.25.24

3 months ago

1.25.23

4 months ago

1.25.22

4 months ago

1.25.20

4 months ago

1.25.21

4 months ago

1.25.19

4 months ago

1.25.18

5 months ago

1.25.17

6 months ago

1.25.15

6 months ago

1.25.16

6 months ago

1.25.1

8 months ago

1.25.4

8 months ago

1.25.5

8 months ago

1.25.13

7 months ago

1.25.2

8 months ago

1.25.14

7 months ago

1.25.3

8 months ago

1.25.8

7 months ago

1.25.9

7 months ago

1.25.6

8 months ago

1.25.7

8 months ago

1.25.11

7 months ago

1.25.12

7 months ago

1.25.10

7 months ago

1.25.0

9 months ago

1.24.1

9 months ago

1.24.2

9 months ago

1.24.0

9 months ago

1.23.1

9 months ago

1.24.3

9 months ago

1.24.4

9 months ago

1.21.0

11 months ago

1.22.0

10 months ago

1.22.3

10 months ago

1.22.4

10 months ago

1.23.0

10 months ago

1.22.1

10 months ago

1.22.2

10 months ago

1.22.7

10 months ago

1.22.8

10 months ago

1.22.5

10 months ago

1.22.6

10 months ago

1.20.0

1 year ago

1.19.0

1 year ago

1.15.0

1 year ago

1.14.0

1 year ago

1.13.1

1 year ago

1.13.0

1 year ago

1.12.0

1 year ago

1.18.0

1 year ago

1.17.0

1 year ago

1.16.0

1 year ago

1.11.0

1 year ago

1.9.1

1 year ago

1.9.0

1 year ago

1.8.0

1 year ago

1.7.0

1 year ago

1.6.0

2 years ago

1.10.0

1 year ago

1.5.0

2 years ago

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago