Skip to content

Commit 6e4c176

Browse files
committed
feat: make allow_access behave closer to htpasswd default auth plugin
- add new unit test for empty access level value config
1 parent 366bc5c commit 6e4c176

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/unit/gitlab.spec.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,24 @@ describe('Gitlab Auth Plugin Unit Tests', () => {
9292
verdaccioGitlab.allow_access(config.remoteUser, _package, cb);
9393
});
9494

95+
test('should allow access to package when access level is empty (default = $all)', done => {
96+
const verdaccioGitlab: VerdaccioGitlab = new VerdaccioGitlab(config.verdaccioGitlabConfig, config.options);
97+
const _package: VerdaccioGitlabPackageAccess = {
98+
name: config.user,
99+
access: undefined,
100+
gitlab: true
101+
};
102+
103+
const cb: Callback = (err, data) => {
104+
expect(err).toBeFalsy();
105+
// false allows the plugin chain to continue
106+
expect(data).toBe(true);
107+
done();
108+
};
109+
110+
verdaccioGitlab.allow_access(config.remoteUser, _package, cb);
111+
});
112+
95113
test('should deny access to package based on unauthenticated', done => {
96114
const verdaccioGitlab: VerdaccioGitlab = new VerdaccioGitlab(config.verdaccioGitlabConfig, config.options);
97115
const unauthenticatedUser: RemoteUser = {

0 commit comments

Comments
 (0)