Wednesday, 4 February 2015

keystone more deeper -- supperAdmin (only implementation)

I have one sample project for supper Admin:

This commit view shows all changes I made for the supper admin functionality, which compared with default yeoman keystone template project.

However, to have supper admin functionality for your project, you don't need do all of them. So the simple implementation is:

1. Add supperAdmin field for your user model:

You can directly copy my User.js file and replace your User.js in your project.

2. Add a authorization checking middleware:

You can directly copy my middleware.js and replace yours.

3. This change is not necessary. Because it is used to create you a supper Admin. Alternatively, you can change your database manually.

Again, you can copy my code into your project directly.

After that you need restart your keystone, a new supper Admin will be created -- password is admin.

No comments:

Post a comment