ff-iii used to have LDAP but we removed it. in the database, 'sso' is still true. the migration here will reset it back to false. for future situations like these, we sync the sso flag on app update itself. this ensures correct behavior when yet another update add back sso support. in ff-iii case, a future update is bringing in proxyAuth based sso! we don't store the 'sso' bit in backupdb, so user choice of sso is lost if restore changes sso addons.
23 lines
698 B
JavaScript
23 lines
698 B
JavaScript
'use strict';
|
|
|
|
const async = require('async');
|
|
|
|
exports.up = function(db, callback) {
|
|
db.all('SELECT * FROM apps', function (error, apps) {
|
|
if (error) return callback(error);
|
|
|
|
async.eachSeries(apps, function (app, iteratorDone) {
|
|
const manifest = JSON.parse(app.manifestJson);
|
|
const hasSso = !!manifest.addons['proxyAuth'] || !!manifest.addons['ldap'];
|
|
if (hasSso || !app.sso) return iteratorDone();
|
|
|
|
console.log(`Unsetting sso flag of ${app.id}`);
|
|
db.runSql('UPDATE apps SET sso=? WHERE id=?', [ 0, app.id ], iteratorDone);
|
|
}, callback);
|
|
});
|
|
};
|
|
|
|
exports.down = function(db, callback) {
|
|
callback();
|
|
};
|