diff options
author | Netanel Gilad <netanelg@wix.com> | 2020-01-28 10:41:36 +0300 |
---|---|---|
committer | Darcy Clarke <darcy@darcyclarke.me> | 2020-02-25 18:47:53 +0300 |
commit | 7d0cd65b23c0986b631b9b54d87bbe74902cc023 (patch) | |
tree | b0520c852c5d953e220642c205bea1a873f070bb | |
parent | 284c1c055a28c4b334496101799acefe3c54ceb3 (diff) |
access: grant is ok with non-scoped
PR-URL: https://github.com/npm/cli/pull/733
Credit: @
Close: #733
Reviewed-by: @Darcy Clarke
-rw-r--r-- | lib/access.js | 2 | ||||
-rw-r--r-- | test/tap/access.js | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/lib/access.js b/lib/access.js index 6657f4b07..e850c132e 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 4183c46b5..f537db258 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( [ |