mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-06 22:40:26 -05:00
fix auth system
This commit is contained in:
parent
834c155da4
commit
a016077bf3
1 changed files with 3 additions and 3 deletions
|
@ -121,17 +121,17 @@ function Config(config) {
|
||||||
function allow_action(package, who, action) {
|
function allow_action(package, who, action) {
|
||||||
return (this.get_package_setting(package, action) || []).reduce(function(prev, curr) {
|
return (this.get_package_setting(package, action) || []).reduce(function(prev, curr) {
|
||||||
if (typeof(who) === 'string' && curr === who) return true
|
if (typeof(who) === 'string' && curr === who) return true
|
||||||
if (Array.isArray(who.groups) && who.groups.indexOf(curr) !== -1) return true
|
if (Array.isArray(who) && who.indexOf(curr) !== -1) return true
|
||||||
return prev
|
return prev
|
||||||
}, false)
|
}, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.prototype.allow_access = function(package, user) {
|
Config.prototype.allow_access = function(package, user) {
|
||||||
return allow_action.call(this, package, user.groups, 'allow_access') || allow_action.call(this, package, user, 'access')
|
return allow_action.call(this, package, user.groups, 'allow_access') || allow_action.call(this, package, user.groups, 'access')
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.prototype.allow_publish = function(package, user) {
|
Config.prototype.allow_publish = function(package, user) {
|
||||||
return allow_action.call(this, package, user.groups, 'allow_publish') || allow_action.call(this, package, user, 'publish')
|
return allow_action.call(this, package, user.groups, 'allow_publish') || allow_action.call(this, package, user.groups, 'publish')
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.prototype.proxy_access = function(package, uplink) {
|
Config.prototype.proxy_access = function(package, uplink) {
|
||||||
|
|
Loading…
Reference in a new issue