2024-04-05 15:45:23 +00:00
|
|
|
export default (client, $hasFeature, $registry) => {
|
2022-10-13 21:18:34 +02:00
|
|
|
return {
|
|
|
|
// TODO implement once endpoint exists
|
2023-03-28 14:40:58 +00:00
|
|
|
get(workspace) {
|
2022-10-13 21:18:34 +02:00
|
|
|
return {
|
2024-04-05 15:45:23 +00:00
|
|
|
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),
|
2024-04-10 14:06:09 +02:00
|
|
|
isDeactivated: role.isDeactivated(workspace.id),
|
2024-04-05 15:45:23 +00:00
|
|
|
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),
|
2024-04-10 14:06:09 +02:00
|
|
|
isDeactivated: role.isDeactivated(workspace.id),
|
2024-04-05 15:45:23 +00:00
|
|
|
}
|
|
|
|
),
|
2022-10-13 21:18:34 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|