mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
fixing the amIAuthorized issues
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user