Skip to content

Commit 7d0cd65

Browse files
netanelgiladdarcyclarke
authored andcommitted
access: grant is ok with non-scoped
PR-URL: #733 Credit: @ Close: #733 Reviewed-by: @darcy Clarke
1 parent 284c1c0 commit 7d0cd65

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

lib/access.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ access.grant = ([perms, scopeteam, pkg], opts) => {
112112
}
113113
return modifyPackage(pkg, opts, (pkgName, opts) => {
114114
return libaccess.grant(pkgName, scopeteam, perms, opts)
115-
})
115+
}, false)
116116
})
117117
}
118118

test/tap/access.js

+27
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,33 @@ test('npm access grant read-write', function (t) {
217217
)
218218
})
219219

220+
test('npm access grant read-write on unscoped package', function (t) {
221+
server.filteringRequestBody((body) => {
222+
const data = JSON.parse(body)
223+
t.deepEqual(data, {
224+
permissions: 'read-write',
225+
package: 'another'
226+
}, 'got the right body')
227+
return true
228+
})
229+
server.put('/-/team/myorg/myteam/package', true).reply(201)
230+
common.npm(
231+
[
232+
'access',
233+
'grant', 'read-write',
234+
'myorg:myteam',
235+
'another',
236+
'--registry', common.registry
237+
],
238+
{ cwd: pkg },
239+
function (er, code, stdout, stderr) {
240+
t.ifError(er, 'npm access grant')
241+
t.equal(code, 0, 'exited with Error')
242+
t.end()
243+
}
244+
)
245+
})
246+
220247
test('npm access grant others', function (t) {
221248
common.npm(
222249
[

0 commit comments

Comments
 (0)