// CONNECTIONS // refuse connections from blocked peers ssb.auth.hook(function (fn, args) { const self = this patchwork.contacts.isBlocking({ source: ssb.id, dest: args[0] }, function (_, blocked) { if (blocked) { args[1](new Error('Client is blocked')) } else { fn.apply(self, args) } }) })
triggers.maybeRunTrigger(triggers.Types.afterSave, this.auth, updatedObject, originalObject, this.config, this.context).then(result => { if (result && typeof result === 'object') { this.response.response = result; } }).catch(function (err) { _logger.default.warn('afterSave caught an error', err); })
handleDelete(req) { return _rest.default.del(req.config, req.auth, this.className(req), req.params.objectId, req.info.context).then(() => { return { response: {} }; }); }
function getCacheKey(options, isSocks) { var auth = options.auth || options.proxyAuth || ''; var ip = (!isSocks && options.clientIp) || ''; return [options.proxyServername ? 'https-proxy' : '', options.isHttps ? 'https' : 'http', options.proxyHost, options.proxyPort, auth, ip, (options.isHttps && options.cacheKey) || ''].join(':'); }
function getPrefix(access) { // prettier-ignore let prefix = `${yesNo(access.create)}Create${yesNo(access.read)}Read${yesNo(access.update)}Update${yesNo(access.auth)}Auth`; if (Object.prototype.hasOwnProperty.call(access, 'delete')) { prefix = `${prefix}${yesNo(access.delete)}Delete`; } return prefix; }
// Helper to get sites for autocomplete const getAutoCompleteSites = (answers, lando, input = null) => { if (!_.isEmpty(pantheonSites)) { return lando.Promise.resolve(pantheonSites).filter(site => _.startsWith(site.name, input)); } else { const api = new PantheonApiClient(answers['pantheon-auth'], lando.log); return api.auth().then(() => api.getSites().map(site => ({name: site.name, value: site.name}))).then(sites => { pantheonSites = sites; return pantheonSites; }); }; }
const App = () => ( <Layout> <Switch> {Object.values(routes).map((route, index) => ( route.auth ? <RoutePrivate {...route} key={index} path={typeof route.path === 'function' ? route.path() : route.path}/> : <Route {...route} key={index} path={typeof route.path === 'function' ? route.path() : route.path}/> ))} <Route component={NotFound}/> </Switch> </Layout> )
// deletes all collections and drops the app from cache function dropApp(req, res) { if (!req.auth.isMaster) { return res.status(401).send({ error: 'unauthorized' }); } return req.config.database.deleteEverything().then(() => { AppCache.del(req.config.applicationId); res.status(200).send({}); }); }
async forgotPassword(ctx) { const input = ctx.request.body; try { await validateForgotPasswordInput(input); } catch (err) { return ctx.badRequest('ValidationError', err); } strapi.admin.services.auth.forgotPassword(input); ctx.status = 204; }
getQueryResolvers({ schemaName }) { if (!this.access[schemaName].auth) return {}; const { authenticatedQueryName } = this.gqlNames; return { [authenticatedQueryName]: (_, __, context, info) => this._authenticatedQuery(context, info), }; }
api.auth().then(() => api.getSiteEnvs(site) .map(env => ({name: env.id, value: env.id})) .filter(env => !_.includes(nopes, env.value)) .then(envs => _.flatten([envs, [{name: 'none', value: 'none'}]]))) .catch(err => { throw (_.has(err, 'response.data')) ? new Error(err.response.data) : err; })
api.auth().then(() => api.getSites()) .filter(site => site.name === options['pantheon-site']) .then(site => { options['pantheon-git-url'] = getGitUrl(site[0]); })
static getJobs(req) { return _rest.default.find(req.config, req.auth, '_JobSchedule', {}, {}).then(scheduledJobs => { return { response: scheduledJobs.results }; }); }
getQueries({ schemaName }) { if (!this.access[schemaName].auth) return []; const { authenticatedQueryName, outputTypeName } = this.gqlNames; return [`${authenticatedQueryName}: ${outputTypeName}`]; }
getQueries({ schemaName }) { if (!this.access[schemaName].auth) return []; const { authenticatedQueryName, outputTypeName } = this.gqlNames; return [`${authenticatedQueryName}: ${outputTypeName}`]; }