Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

access: grant is ok with non-scoped #733

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/access.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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