mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
Populate only role relation to authorize user
This commit is contained in:
parent
c603ec3499
commit
cff8fd9041
@ -16,11 +16,11 @@ module.exports = async (ctx, next) => {
|
||||
if (isAdmin) {
|
||||
ctx.state.admin = await strapi
|
||||
.query('administrator', 'admin')
|
||||
.findOne({ id });
|
||||
.findOne({ id }, ['role']);
|
||||
} else {
|
||||
ctx.state.user = await strapi
|
||||
.query('user', 'users-permissions')
|
||||
.findOne({ id });
|
||||
.findOne({ id }, ['role']);
|
||||
}
|
||||
} catch (err) {
|
||||
return handleErrors(ctx, err, 'unauthorized');
|
||||
|
Loading…
x
Reference in New Issue
Block a user