1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 02:09:32 +02:00

allow user to create an access token to access stf api from user settings tab.

This commit is contained in:
Vishal Banthia 2015-11-19 19:50:33 +09:00
parent ddc24e5dc5
commit 62413b3780
21 changed files with 263 additions and 65 deletions

View file

@ -308,4 +308,22 @@ dbapi.loadDevice = function(serial) {
return db.run(r.table('devices').get(serial))
}
dbapi.saveUserAccessToken = function(email, token) {
return db.run(r.table('users').get(email).update({
accessTokens: r.row('accessTokens').default([]).append({
title: token.title
, tokenId: token.tokenId
, jwt: token.jwt
})
}))
}
dbapi.removeUserAccessToken = function(email, title) {
return db.run(r.table('users').get(email).update({
accessTokens: r.row('accessTokens').default([]).filter(function(token) {
return token('title').ne(title)
})
}))
}
module.exports = dbapi