From b24789e5d7a991ae729f97ee06b6dee047fe5c0e Mon Sep 17 00:00:00 2001 From: Netanel Gilad Date: Tue, 28 Jan 2020 09:41:36 +0200 Subject: [PATCH] access: grant is ok with non-scoped --- lib/access.js | 2 +- test/tap/access.js | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/access.js b/lib/access.js index 6657f4b0717a1..e850c132eb24b 100644 --- a/lib/access.js +++ b/lib/access.js @@ -112,7 +112,7 @@ access.grant = ([perms, scopeteam, pkg], opts) => { } return modifyPackage(pkg, opts, (pkgName, opts) => { return libaccess.grant(pkgName, scopeteam, perms, opts) - }) + }, false) }) } diff --git a/test/tap/access.js b/test/tap/access.js index 4183c46b538c0..f537db2586409 100644 --- a/test/tap/access.js +++ b/test/tap/access.js @@ -217,6 +217,33 @@ test('npm access grant read-write', function (t) { ) }) +test('npm access grant read-write on unscoped package', function (t) { + server.filteringRequestBody((body) => { + const data = JSON.parse(body) + t.deepEqual(data, { + permissions: 'read-write', + package: 'another' + }, 'got the right body') + return true + }) + server.put('/-/team/myorg/myteam/package', true).reply(201) + common.npm( + [ + 'access', + 'grant', 'read-write', + 'myorg:myteam', + 'another', + '--registry', common.registry + ], + { cwd: pkg }, + function (er, code, stdout, stderr) { + t.ifError(er, 'npm access grant') + t.equal(code, 0, 'exited with Error') + t.end() + } + ) +}) + test('npm access grant others', function (t) { common.npm( [