mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
bed0a2962f
## 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.
25 lines
729 B
TypeScript
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 });
|