Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
fix: admin can not publish non scoped package on "none" sync model
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Feb 2, 2015
1 parent 24d6831 commit 6dc779a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion middleware/publishable.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function checkNoneScope(ctx) {
}

// only admins can publish or unpublish non-scope modules
if (ctx.user.isAdmin) {
if (ctx.user.isAdmin && config.syncModel !== 'none') {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion test/controllers/registry/package/deprecate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ describe('controllers/registry/package/deprecate.test.js', function () {
})
.expect({
error: 'no_perms',
reason: 'Private mode enable, only admin can publish this module'
reason: 'only allow publish with @cnpm, @cnpmtest scope(s)'
})
.expect(403, done);
});
Expand Down
1 change: 0 additions & 1 deletion test/controllers/registry/package/dist_tag.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ var pedding = require('pedding');
var should = require('should');
var app = require('../../../../servers/registry');
var utils = require('../../../utils');
var config = require('../../../../config');

describe('controllers/registry/package/dist_tag.test.js', function () {
afterEach(mm.restore);
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/registry/package/remove.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('controllers/registry/package/remove.test.js', function () {
.del('/testmodule-remove-1/-rev/1')
.expect({
error: 'unauthorized',
reason: 'Login first.'
reason: 'Login first'
})
.expect(401, done);
});
Expand Down

0 comments on commit 6dc779a

Please sign in to comment.