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:
Ilja 2022-08-06 11:43:06 +02:00
parent 610720f164
commit 0d714f07ec
1 changed files with 27 additions and 0 deletions

View File

@ -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) {