1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00
unleash.unleash/src/lib/schema/role-schema.ts
Gastón Fournier bed0a2962f
chore: Improve access service iter 2 (#4779)
## About the changes
In https://github.com/Unleash/unleash/pull/4689 I forgot to add backward
compatibility for a public method that was being used in Enterprise.
2023-09-19 16:15:27 +02:00

25 lines
729 B
TypeScript

import joi from 'joi';
export const permissionRoleSchema = joi
.object()
.keys({
id: joi.number(),
name: joi.string(),
environment: joi.string().optional().allow('').allow(null).default(''),
})
.or('id', 'name')
.options({ stripUnknown: true, allowUnknown: false, abortEarly: false });
export const roleSchema = joi
.object()
.keys({
name: joi.string().required(),
description: joi.string().optional().allow('').allow(null).default(''),
permissions: joi
.array()
.allow(null)
.optional()
.items(permissionRoleSchema),
})
.options({ stripUnknown: true, allowUnknown: false, abortEarly: false });