Sync_gateway couchbase requireRole -
i have problem roles of sync_gateway
. sync_function
throws missing role
error @ requirerole("adminsync");
.
i'm accessing user admin1 configured follows:
"name": "admin1", "all_channels": {}, "passwordhash_bcrypt": "**************", "explicit_roles": { "adminsync": 1 }, "rolessince": { "adminsync": 1 }
also have role configured as:
{ "name": "adminsync", "admin_channels": { "ch_horas": 1, "ch_personas": 1, "ch_proyectos": 1 }, "all_channels": { "ch_horas": 1, "ch_personas": 1, "ch_proyectos": 1 } }
any idea of error??
thanks.
re, found out wrong,
the variable realuserctx.roles map, according requirerole(..) needs compare 2 arrays, return false.
so needed change source code of src/channels/sync_runner.go convert map array before comparison.
function maptoarray(mapobject){ var _array = []; if(mapobject){ (var property in mapobject) { _array.push(property); } } return _array; }
then..
function requirerole(roles) { ... if (!anyinarray(maptoarray(realuserctx.roles), roles)) }
if need more explanations can contact me in private message. luck
Comments
Post a Comment