cartodb-redis
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -744,4 +744,2 @@ /** | ||
var that = this; // AUTH_FALLBACK | ||
this.getMultipleApikeyParams(username, apikeyToken, apikeyParams, function(err, apikey) { | ||
@@ -752,18 +750,2 @@ if (err) { | ||
// Remove this block when Auth fallback is not used anymore | ||
// AUTH_FALLBACK | ||
if (!isValidApikey(apikey)) { | ||
if (apikeyToken === 'default_public') { | ||
return that.createFauxDefaultApikeyFromUserMetadata(username, callback); | ||
} | ||
return that.getUserMapKey(username, function (err, masterApikeyToken) { | ||
if (masterApikeyToken !== apikeyToken) { | ||
return that.createFauxDefaultApikeyFromUserMetadata(username, callback); | ||
} | ||
return that.createFauxMasterApikeyFromUserMetadata(username, apikeyToken, callback); | ||
}); | ||
} | ||
apikey.grantsMaps = (apikey.grantsMaps === 'true'); | ||
@@ -783,81 +765,2 @@ apikey.grantsSql = (apikey.grantsSql === 'true'); | ||
// DEPRECATED. Used only until Auth fallback in use | ||
// AUTH_FALLBACK | ||
function isValidApikey(apikey) { | ||
return apikey.type !== null && | ||
apikey.user !== null && | ||
apikey.databasePassword !== null && | ||
apikey.databaseRole !== null; | ||
} | ||
// DEPRECATED. Used only until Auth fallback in use | ||
// AUTH_FALLBACK | ||
function addGrantsFieldsToUserMetadataApikeys(apikey) { | ||
apikey.grantsMaps = true; | ||
apikey.grantsSql = true; | ||
return apikey; | ||
} | ||
// DEPRECATED. Used only until Auth fallback in use | ||
// AUTH_FALLBACK | ||
me.createFauxMasterApikeyFromUserMetadata = function (username, apikeyToken, callback) { | ||
var dbParams = { | ||
id: 'user_id', | ||
database_password: 'database_password', | ||
map_key: 'map_key', | ||
database_host: 'dbhost', | ||
database_name: 'dbname' | ||
}; | ||
this.getMultipleUserDBParams(username, dbParams, function(err, params){ | ||
var apikey = {}; | ||
if (err) { | ||
return callback(null, {}); | ||
} | ||
if (params.map_key === apikeyToken) { | ||
apikey.user_id = params.user_id; | ||
apikey.databaseRole = null; | ||
apikey.databasePassword = params.database_password; | ||
apikey.user = username; | ||
apikey.type = 'master'; | ||
addGrantsFieldsToUserMetadataApikeys(apikey); | ||
} | ||
return callback(null, apikey); | ||
}); | ||
}; | ||
// DEPRECATED. Used only until Auth fallback in use | ||
// AUTH_FALLBACK | ||
me.createFauxDefaultApikeyFromUserMetadata = function (username, callback) { | ||
var dbParams = { | ||
id: 'user_id', | ||
database_publicuser: 'database_publicuser', | ||
database_host: 'dbhost', | ||
database_name: 'dbname' | ||
}; | ||
this.getMultipleUserDBParams(username, dbParams, function (err, params) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
var apikey = {}; | ||
apikey.userId = params.id; | ||
apikey.databaseRole = params.database_publicuser; | ||
apikey.databasePassword = null; | ||
apikey.user = username; | ||
apikey.type = 'default'; | ||
addGrantsFieldsToUserMetadataApikeys(apikey); | ||
return callback(null, apikey); | ||
}); | ||
}; | ||
/******************************************************************************************************************* | ||
@@ -864,0 +767,0 @@ * END AUTH |
{ | ||
"name": "cartodb-redis", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "./lib/carto_metadata.js", | ||
@@ -5,0 +5,0 @@ "description": "A Node.js based lib to interact with cartodb redis databases", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34570
8
666