Skip to content

Commit

Permalink
access: grant is ok with non-scoped
Browse files Browse the repository at this point in the history
PR-URL: #733
Credit: @
Close: #733
Reviewed-by: @darcy Clarke
  • Loading branch information
netanelgilad authored and darcyclarke committed Feb 25, 2020
1 parent 284c1c0 commit 7d0cd65
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/access.js
Expand Up @@ -112,7 +112,7 @@ access.grant = ([perms, scopeteam, pkg], opts) => {
}
return modifyPackage(pkg, opts, (pkgName, opts) => {
return libaccess.grant(pkgName, scopeteam, perms, opts)
})
}, false)
})
}

Expand Down
27 changes: 27 additions & 0 deletions test/tap/access.js
Expand Up @@ -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(
[
Expand Down

0 comments on commit 7d0cd65

Please sign in to comment.