|
|
|
@ -5,6 +5,7 @@ const meta = require('../../meta');
|
|
|
|
|
const helpers = require('../helpers');
|
|
|
|
|
const groups = require('../../groups');
|
|
|
|
|
const privileges = require('../../privileges');
|
|
|
|
|
const plugins = require('../../plugins');
|
|
|
|
|
const accountHelpers = require('./helpers');
|
|
|
|
|
const file = require('../../file');
|
|
|
|
|
|
|
|
|
@ -19,9 +20,10 @@ editController.get = async function (req, res) {
|
|
|
|
|
groups: _groups,
|
|
|
|
|
groupTitleArray,
|
|
|
|
|
allowMultipleBadges,
|
|
|
|
|
}, canUseSignature] = await Promise.all([
|
|
|
|
|
}, canUseSignature, canManageUsers] = await Promise.all([
|
|
|
|
|
accountHelpers.getUserDataByUserSlug(req.params.userslug, req.uid, req.query),
|
|
|
|
|
privileges.global.can('signature', req.uid),
|
|
|
|
|
privileges.admin.can('admin:users', req.uid),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
const payload = {};
|
|
|
|
@ -38,6 +40,10 @@ editController.get = async function (req, res) {
|
|
|
|
|
|
|
|
|
|
payload.groups = _groups.filter(g => g && g.userTitleEnabled && !groups.isPrivilegeGroup(g.name) && g.name !== 'registered-users');
|
|
|
|
|
|
|
|
|
|
if (req.uid === res.locals.uid || canManageUsers) {
|
|
|
|
|
payload.sso = await plugins.hooks.fire('filter:auth.list', { uid: res.locals.uid, associations: [] });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!allowMultipleBadges) {
|
|
|
|
|
payload.groupTitle = groupTitleArray[0];
|
|
|
|
|
}
|
|
|
|
|