0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

fix auth system

This commit is contained in:
Alex Kocharin 2014-09-14 19:22:24 +04:00
parent 834c155da4
commit a016077bf3

View file

@ -121,17 +121,17 @@ function Config(config) {
function allow_action(package, who, action) {
return (this.get_package_setting(package, action) || []).reduce(function(prev, curr) {
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
}, false)
}
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) {
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) {