@@ -62,7 +62,7 @@ export default class VerdaccioGitLab implements IPluginAuth {
62
62
63
63
if ( this . config . legacy_mode ) {
64
64
this . publishLevel = '$owner' ;
65
- this . logger . info ( '[gitlab] legacy mode active pre-gitlab v11.2 active, publish is only allowed to group owners' ) ;
65
+ this . logger . info ( '[gitlab] legacy mode pre-gitlab v11.2 active, publish is only allowed to group owners' ) ;
66
66
} else {
67
67
this . publishLevel = '$maintainer' ;
68
68
if ( this . config . publish ) {
@@ -110,7 +110,7 @@ export default class VerdaccioGitLab implements IPluginAuth {
110
110
// - for publish, the logged in user id and all the groups they can reach as configured with access level `$auth.gitlab.publish`
111
111
//
112
112
// In legacy mode, the groups are:
113
- // - for access, themselves and all groups with access level $owner
113
+ // - for access, depending on the package settings in verdaccio
114
114
// - for publish, the logged in user id and all the groups they can reach as `$owner`
115
115
const gitlabPublishQueryParams = this . config . legacy_mode ? { owned : true } : { min_access_level : publishLevelId } ;
116
116
const pPublishGroups = GitlabAPI . Groups . all ( gitlabPublishQueryParams ) . then ( groups => {
@@ -150,12 +150,12 @@ export default class VerdaccioGitLab implements IPluginAuth {
150
150
if ( ( _package . access || [ ] ) . includes ( '$authenticated' ) && user . name !== undefined ) {
151
151
this . logger . debug ( `[gitlab] allow user: ${ user . name } access to package: ${ _package . name } ` ) ;
152
152
return cb ( null , true ) ;
153
- } else if ( ! ( _package . access || [ ] ) . includes ( '$authenticated ' ) ) {
153
+ } else if ( ( _package . access || [ ] ) . includes ( '$all ' ) ) {
154
154
this . logger . debug ( `[gitlab] allow unauthenticated access to package: ${ _package . name } ` ) ;
155
155
return cb ( null , true ) ;
156
156
} else {
157
- this . logger . debug ( `[gitlab] deny user: ${ user . name || '' } access to package: ${ _package . name } ` ) ;
158
- return cb ( null , false ) ;
157
+ this . logger . debug ( `[gitlab] deny user: ${ user . name || '<empty> ' } access to package: ${ _package . name } ` ) ;
158
+ return cb ( httperror [ 401 ] ( 'access denied, user not authenticated in gitlab and unauthenticated package access disabled' ) ) ;
159
159
}
160
160
}
161
161
0 commit comments