Add priviliges
We can now check what priviliges someone has besides only the role. On older back-ends, privileges aren't provided, so we have a fall-back to list the privileges corresponding to what mods/admins are allowed on older BE's.
This commit is contained in:
parent
610720f164
commit
0d714f07ec
|
@ -119,6 +119,33 @@ export const parseUser = (data) => {
|
||||||
} else {
|
} else {
|
||||||
output.role = 'member'
|
output.role = 'member'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.pleroma.privileges) {
|
||||||
|
output.privileges = data.pleroma.privileges
|
||||||
|
} else if (data.pleroma.is_admin) {
|
||||||
|
output.privileges = [
|
||||||
|
'users_read',
|
||||||
|
'users_manage_invites',
|
||||||
|
'users_manage_activation_state',
|
||||||
|
'users_manage_tags',
|
||||||
|
'users_manage_credentials',
|
||||||
|
'users_delete',
|
||||||
|
'messages_read',
|
||||||
|
'messages_delete',
|
||||||
|
'instances_delete',
|
||||||
|
'reports_manage_reports',
|
||||||
|
'moderation_log_read',
|
||||||
|
'announcements_manage_announcements',
|
||||||
|
'emoji_manage_emoji',
|
||||||
|
'statistics_read'
|
||||||
|
]
|
||||||
|
} else if (data.pleroma.is_moderator) {
|
||||||
|
output.privileges = [
|
||||||
|
'messages_delete'
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
output.privileges = []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.source) {
|
if (data.source) {
|
||||||
|
|
Loading…
Reference in New Issue