diff --git a/tools/commands-packages.js b/tools/commands-packages.js index aa9e929762..ddd2535473 100644 --- a/tools/commands-packages.js +++ b/tools/commands-packages.js @@ -417,7 +417,7 @@ main.registerCommand({ // We are going to call the server to check if we are authorized, so that when // we implement things like organizations, we are not handicapped by the // user's meteor version. - if (!packageClient.amIAuthorized(relConf.track, true)) { + if (!packageClient.amIAuthorized(relConf.track,conn, true)) { process.stderr.write('\n You are not an authorized maintainer of ' + relConf.track + ".\n"); process.stderr.write('Only authorized maintainers may publish new versions.\n'); return 1; diff --git a/tools/package-client.js b/tools/package-client.js index 803fb7fe05..1a07b75a47 100644 --- a/tools/package-client.js +++ b/tools/package-client.js @@ -499,7 +499,7 @@ exports.publishPackage = function (packageSource, compileResult, conn, options) return 1; } - if (!amIAuthorized(name, false)) { + if (!amIAuthorized(name, conn, false)) { process.stderr.write('You are not an authorized maintainer of ' + name + ".\n"); process.stderr.write('Only authorized maintainers may publish new versions. \n'); return 1; @@ -654,8 +654,7 @@ exports.publishPackage = function (packageSource, compileResult, conn, options) // // If this returns FALSE, then we are NOT authorized. // Otherwise, return true. -var amIAuthorized = function (name, isRelease) { - var conn = openPackageServerConnection(); +var amIAuthorized = function (name, conn, isRelease) { var methodName = "amIAuthorized" + (isRelease ? "Release" : "Package"); @@ -663,7 +662,7 @@ var amIAuthorized = function (name, isRelease) { conn.call(methodName, name); } catch (err) { conn.close(); - if (err.error === 404) { + if (err.error === 401) { return false; }