Last active
January 16, 2019 11:46
-
-
Save gwuah/eca9b3d52a40a3c5a3c96abfc4aa4f30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Ottis = require('../lib'); | |
const router = Ottis.router; | |
const {admin, customer} = require('./permissions'); | |
/* Initialise Ottis with various roles */ | |
const auth = Ottis(["admin","customer"]); | |
/* Admin Config */ | |
auth.addConfigFor('admin').forResource('customers')({ | |
config: admin.customers | |
}).forResource('anonymous-customers')({ | |
config: admin.anonymousCustomers | |
}).forResource('products')({ | |
config: admin.products | |
}) | |
/* Customer Config */ | |
auth.addConfigFor('customer').forResource('customers')({ | |
config: customer.customers | |
}).forResource('anonymous-customers')({ | |
config: customer.anonymousCustomers | |
}).forResource('products')({ | |
config: customer.products | |
}); | |
/* Take note of the exported method */ | |
module.exports = auth.User; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment