add remoteDebugUrl into database so that it is accessible from api

This commit is contained in:
Vishal Banthia
2015-12-07 19:36:56 +09:00
parent 0cc1a0d4bd
commit 94d7c77154
5 changed files with 60 additions and 0 deletions

View File

@@ -53,10 +53,20 @@ datautil.applyOwner = function(device, user) {
return device
}
// Only owner can see this information
datautil.applyOwnerOnlyInfo = function(device, user) {
if (device.owner && device.owner.email === user.email) {
} else {
device.remoteConnect = false
device.remoteDebugUrl = null
}
}
datautil.normalize = function(device, user) {
datautil.applyData(device)
datautil.applyBrowsers(device)
datautil.applyOwner(device, user)
datautil.applyOwnerOnlyInfo(device, user)
if (!device.present) {
device.owner = null
}