Skip to content

Commit

Permalink
updated token model, fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gregfrasco committed Aug 28, 2018
1 parent b61a048 commit f80f283
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions server/models/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ class Token extends AnchorModel {

document = {
description: document.description,
isActive: true,
createdAt: new Date(),
key:keyHash.hash,
key: keyHash.hash,
userId: document.userId,
permissions: document.permissions || {}
};
Expand All @@ -36,7 +34,7 @@ Token.schema = Joi.object({
key: Joi.string().required(),
userId: Joi.string().required(),
description: Joi.string().required(),
active: Joi.boolean().default(true),
isActive: Joi.boolean().default(true),
createdAt: Joi.date(),
updatedAt: Joi.date(),
lastUsed: Joi.date(),
Expand Down
2 changes: 1 addition & 1 deletion test/server/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ lab.experiment('Token Auth Strategy', () => {
lab.test('it returns as valid when all is well', async () => {

const { user } = await Fixtures.Creds.createUser('Ren','321!abc','ren@stimpy.show','Stimpy');
const token = await Token.create({ userId: `${user._id}`, description: 'test token' });
const token = await Token.create({ userId: `${user._id}`, description: 'test token', permissions: { 'GET-token':true } });

const request = {
method: 'GET',
Expand Down

0 comments on commit f80f283

Please sign in to comment.