fixing the amIAuthorized issues

This commit is contained in:
ekatek
2014-08-05 11:04:15 -07:00
parent 5e4c8cd276
commit 64ddf8a979
2 changed files with 4 additions and 5 deletions

View File

@@ -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;

View File

@@ -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;
}