0
Fork 0
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:
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) { 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) {