Merge pull request #29 from rmessner/issue-playbook-creation

Fix Identity not being attached to a playbook on creation
This commit is contained in:
Matej Kramny 2015-09-15 10:27:14 +01:00
commit 6d6085a2d5

View File

@ -39,9 +39,9 @@ function addPlaybook (req, res) {
vault_password: req.body.vault_password
})
if (req.body.credential && req.body.credential.length > 0) {
if (typeof req.body.identity == 'string' && req.body.identity.length > 0) {
try {
playbook.credential = mongoose.Types.ObjectId(req.body.credential)
playbook.identity = mongoose.Types.ObjectId(req.body.identity);
} catch (e) {}
}