heroku-connect-plugin
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -102,3 +102,3 @@ var https = require('https'); | ||
var withUserConnections = exports.withUserConnections = function(token, appName, flags){ | ||
var withUserConnections = exports.withUserConnections = function(token, appName, flags, allowNone){ | ||
global_config(); | ||
@@ -120,3 +120,3 @@ | ||
} | ||
if (connections.length > 0) { | ||
if (connections.length > 0 || allowNone) { | ||
resolve(connections); | ||
@@ -180,1 +180,16 @@ } else { | ||
}; | ||
exports.requestAppAccess = function(token, app) { | ||
global_config(); | ||
return exports.withUser(token).then(function(user_id) { | ||
console.log("Got user id ", user_id); | ||
var url = '/api/v3/users/' + user_id + '/apps/' + app + '/auth'; | ||
console.log("POST ", url); | ||
return request(token, 'POST', url).then(function(response){ | ||
return Q.Promise(function(resolve, reject){ | ||
resolve(response.json); | ||
}); | ||
}); | ||
}); | ||
} |
@@ -12,2 +12,12 @@ 'use strict'; | ||
function connections_status(connections) { | ||
if (connections.length == 0) { | ||
console.log("No connections found"); | ||
} | ||
connections.forEach(function(connection) { | ||
connection_info(connection); | ||
console.log(""); | ||
}); | ||
} | ||
module.exports = { | ||
@@ -25,9 +35,16 @@ topic: 'connect', | ||
run: function (context) { | ||
api.withUserConnections(context.auth.password, context.app, context.flags).then(function(connections){ | ||
connections.forEach(function(connection) { | ||
connection_info(connection); | ||
console.log(""); | ||
}); | ||
console.log(context.auth.password); | ||
api.withUserConnections(context.auth.password, context.app, context.flags, true).then(function(connections){ | ||
if (connections.length === 0) { | ||
console.log("No connection found, requesting auth..."); | ||
api.requestAppAccess(context.auth.password, context.app).then(function() { | ||
api.withUserConnections(context.auth.password, context.app, context.flags).then(function(connections){ | ||
connections_status(connections); | ||
}); | ||
}); | ||
} else { | ||
connections_status(connections); | ||
} | ||
}); | ||
} | ||
}; |
{ | ||
"name": "heroku-connect-plugin", | ||
"description": "Minimal Heroku Connect plugin for Heroku Toolbelt", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"author": "Scott Persinger @persingerscott", | ||
@@ -6,0 +6,0 @@ "bugs": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19943
547