As a result, I got such a script, maybe it will be useful to someone.
const Theme = {} const user = require.main.require('./src/user') const privileges = require.main.require('./src/privileges') Theme.getUsersByCategory = async function(data) { const { templateData: { cid } } = data const allUserIds = await user.getUidsFromSet('users:joindate', 0, -1) const asyncFilter = async (arr, predicate) => { const results = await Promise.all(arr.map(predicate)) return arr.filter((element, index) => results[index]) } const availableUserIds = await asyncFilter(allUserIds, async (id) => { return await privileges.categories.can('read', cid, id) }) data.templateData.availableUsers = await user.getUsersData(availableUserIds) return data } module.exports = ThemeAuto Login from Custom User Database
-
Hi,
I was wondering what the recommended practice for Auto Login was. I have a "members only" area of my website, and from there I would like them to be able to access a forum, but ideally they would be signed in. The current solution isn't OAuth based, so I'm not sure if that's the best route to go down - or if there might be a hackier alternative?Thanks,
Chris -
The best solution would be to expose your login process as an OAuth endpoint, via something like OAuth2orize, and then install a corresponding fork of this SSO plugin to talk to your endpoint.