Adam Beck
Adam Beck

Reputation: 238

Extending keystone.js auth

I'm trying to find a way to limit access to certain pages based on whether they are logged in as a keystone.js admin - is there a way to extend their existing admin auth to apply to pages outside of the admin interface?

Upvotes: 0

Views: 456

Answers (1)

Shea Hunter Belsky
Shea Hunter Belsky

Reputation: 3218

If you're using the Yeoman generator, the User model has an isAdmin property. Within your Express route, you can determine if req.user exists, then if req.user.isAdmin is true.

Upvotes: 2

Related Questions