1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-21 23:37:55 +00:00
bramw_baserow/web-frontend/modules/core/services/roles.js
2024-04-10 14:06:09 +02:00

31 lines
1.1 KiB
JavaScript

export default (client, $hasFeature, $registry) => {
return {
// TODO implement once endpoint exists
get(workspace) {
return {
data: Object.values($registry.getAll('roles')).map((role) =>
role.getUid() === 'NO_ROLE_LOW_PRIORITY'
? {
uid: role.getUid(),
description: role.getDescription(),
showIsBillable: role.showIsBillable(workspace.id),
isBillable: role.getIsBillable(workspace.id),
isVisible: role.isVisible(workspace.id),
isDeactivated: role.isDeactivated(workspace.id),
allowed_scope_types: ['workspace'],
allowed_subject_types: ['auth.User'],
}
: {
uid: role.getUid(),
description: role.getDescription(),
showIsBillable: role.showIsBillable(workspace.id),
isBillable: role.getIsBillable(workspace.id),
isVisible: role.isVisible(workspace.id),
isDeactivated: role.isDeactivated(workspace.id),
}
),
}
},
}
}