From 0a1cd5cb748ea475b08f4220f2ea349d3291d3ae Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 29 May 2023 11:29:31 +0300 Subject: [PATCH] schema fixes --- schema/metadata/app/acl.json | 5 +- schema/metadata/app/aclPortal.json | 7 +- schema/metadata/app/adminPanel.json | 49 +-- schema/metadata/clientDefs.json | 306 +++++++++++------- .../metadata/components/accessDataList.json | 52 --- schema/metadata/dashlets.json | 3 +- schema/metadata/fields.json | 29 +- schema/metadata/integrations.json | 5 +- schema/metadata/pdfDefs.json | 5 +- schema/metadata/scopes.json | 8 +- 10 files changed, 256 insertions(+), 213 deletions(-) delete mode 100644 schema/metadata/components/accessDataList.json diff --git a/schema/metadata/app/acl.json b/schema/metadata/app/acl.json index 2e83e73f21..1e35f27c75 100644 --- a/schema/metadata/app/acl.json +++ b/schema/metadata/app/acl.json @@ -21,7 +21,10 @@ "type": "array", "description": "A list of all available permissions in the system.", "items": { - "type": "string" + "anyOf": [ + {"const": "__APPEND__"}, + {"type": "string"} + ] } }, "valuePermissionHighestLevels": { diff --git a/schema/metadata/app/aclPortal.json b/schema/metadata/app/aclPortal.json index 1f9d169c36..6485cacaaa 100644 --- a/schema/metadata/app/aclPortal.json +++ b/schema/metadata/app/aclPortal.json @@ -20,9 +20,10 @@ "valuePermissionList": { "type": "array", "description": "A list of all available permissions in the system.", - "items": { - "type": "string" - } + "anyOf": [ + {"const": "__APPEND__"}, + {"type": "string"} + ] }, "valuePermissionHighestLevels": { "type": "object", diff --git a/schema/metadata/app/adminPanel.json b/schema/metadata/app/adminPanel.json index 36fd7b1e5d..3d1d02af7e 100644 --- a/schema/metadata/app/adminPanel.json +++ b/schema/metadata/app/adminPanel.json @@ -20,29 +20,34 @@ "type": "array", "description": "Items.", "items": { - "type": "object", - "properties": { - "url": { - "type": "string", - "description": "A link URL. You can use an URL like #Admin/{myName}, in this case you also need to define a recordView." - }, - "label": { - "type": "string", - "description": "An item (link) label. A translation path: Admin > labels > {label}." - }, - "iconClass": { - "type": "string", - "description": "A CSS class for the icon." - }, - "description": { - "type": "string", - "description": "A translation key for a description text. A translation page: Admin > descriptions > {description}." - }, - "recordView": { - "type": "string", - "description": "A record view. Optional. Needed if you defined the URL like #Admin/{myName}. The record view displays settings fields. https://docs.espocrm.com/development/custom-config-parameters/" + "anyOf": [ + {"const": "__APPEND__"}, + { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "A link URL. You can use an URL like #Admin/{myName}, in this case you also need to define a recordView." + }, + "label": { + "type": "string", + "description": "An item (link) label. A translation path: Admin > labels > {label}." + }, + "iconClass": { + "type": "string", + "description": "A CSS class for the icon." + }, + "description": { + "type": "string", + "description": "A translation key for a description text. A translation page: Admin > descriptions > {description}." + }, + "recordView": { + "type": "string", + "description": "A record view. Optional. Needed if you defined the URL like #Admin/{myName}. The record view displays settings fields. https://docs.espocrm.com/development/custom-config-parameters/" + } + } } - } + ] } } } diff --git a/schema/metadata/clientDefs.json b/schema/metadata/clientDefs.json index 036d05ac3c..e4f4a5c5fc 100644 --- a/schema/metadata/clientDefs.json +++ b/schema/metadata/clientDefs.json @@ -94,6 +94,8 @@ "type": "array", "items": { "anyOf": [ + {"const": "__APPEND__"}, + {"type": "string"}, { "type": "object", "properties": { @@ -104,10 +106,12 @@ "style": { "enum": ["default", "success", "warning", "danger", "info"], "description": "A style." + }, + "accessDataList": { + "$ref": "#/definitions/accessDataList" } } - }, - {"type": "string"} + } ] } }, @@ -115,7 +119,23 @@ "description": "A list of bool filters.", "type": "array", "items": { - "type": "string" + "type": "string", + "anyOf": [ + {"const": "__APPEND__"}, + {"type": "string"}, + { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "A filter name." + }, + "accessDataList": { + "$ref": "#/definitions/accessDataList" + } + } + } + ] } }, "defaultFilterData": { @@ -210,7 +230,7 @@ "description": "An init function of the handler." }, "accessDataList": { - "$ref": "./components/accessDataList.json" + "$ref": "#/definitions/accessDataList" } } } @@ -225,33 +245,61 @@ "additionalProperties": { "type": "array", "items": { - "type": "object", - "properties": { - "name": { - "description": "A name.", - "type": "string" - }, - "label": { - "description": "A translatable label.", - "type": "string" - }, - "view": { - "description": "A view class.", - "type": "string" - }, - "options": { - "description": "Options to be passed to the view.", - "type": "object" - }, - "isForm": { - "description": "Whether the panel should display a form.", - "type": "boolean" - }, - "notRefreshable": { - "description": "Disable the ability to refresh the panel.", - "type": "boolean" + "anyOf": [ + {"const": "__APPEND__"}, + { + "type": "object", + "properties": { + "name": { + "description": "A name.", + "type": "string" + }, + "label": { + "description": "A translatable label.", + "type": "string" + }, + "view": { + "description": "A view class.", + "type": "string" + }, + "options": { + "description": "Options to be passed to the view.", + "type": "object" + }, + "isForm": { + "description": "Whether the panel should display a form.", + "type": "boolean" + }, + "notRefreshable": { + "description": "Disable the ability to refresh the panel.", + "type": "boolean" + }, + "style": { + "description": "A style.", + "enum": ["default", "success", "warning", "danger"] + }, + "hidden": { + "description": "Hidden by default.", + "type": "boolean" + }, + "aclScope": { + "description": "A scope access to which is required for the panel being visible.", + "type": "string" + }, + "acl": { + "description": "An ACL action access to which is required for the panel being visible.", + "type": "string", + "enum": [ + "create", + "read", + "edit", + "delete", + "stream" + ] + } + } } - } + ] } } }, @@ -264,6 +312,7 @@ "type": "object", "additionalProperties": { "type": "object", + "description": "A link.", "properties": { "view": { "description": "A view class.", @@ -357,14 +406,20 @@ "description": "Mass actions.", "type": "array", "items": { - "type": "string" + "anyOf": [ + {"const": "__APPEND__"}, + {"type": "string"} + ] } }, "checkAllResultMassActionList": { "description": "Mass actions available when selecting all results.", "type": "array", "items": { - "type": "string" + "anyOf": [ + {"const": "__APPEND__"}, + {"type": "string"} + ] } }, "massActionDefs": { @@ -390,7 +445,7 @@ "type": "string" }, "acl": { - "description": "An acl action access to which is required for the action.", + "description": "An ACL action access to which is required for the action.", "type": "string", "enum": [ "create", @@ -407,96 +462,24 @@ "description": "Detail view actions (available from the dropdown next to the Edit button).", "type": "array", "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "A name." - }, - "label": { - "type": "string", - "description": "A translatable label." - }, - "handler": { - "type": "string", - "description": "A handler class for the action." - }, - "initFunction": { - "type": "string", - "description": "An init function of the handler." - }, - "checkVisibilityFunction": { - "type": "string", - "description": "The handler function that checks whether the action is available. Should return a boolean value. Called on model sync." - }, - "configCheck": { - "description": "A config path (separated by the .) to check whether the action is enabled. The ! prefix reverts.", - "type": "string" - }, - "aclScope": { - "description": "A scope access to which is required for the action.", - "type": "string" - }, - "acl": { - "description": "An acl action access to which is required for the action.", - "type": "string", - "enum": [ - "create", - "read", - "edit", - "delete", - "stream" - ] + "anyOf": [ + {"const": "__APPEND__"}, + { + "$ref": "#/definitions/actionDefs" } - } + ] } }, "modalDetailActionList": { "description": "Modal detail view actions.", "type": "array", "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "A name." - }, - "label": { - "type": "string", - "description": "A translatable label." - }, - "handler": { - "type": "string", - "description": "A handler class for the action." - }, - "initFunction": { - "type": "string", - "description": "An init function of the handler." - }, - "checkVisibilityFunction": { - "type": "string", - "description": "The handler function that checks whether the action is available. Should return a boolean value. Called on model sync." - }, - "configCheck": { - "description": "A config path (separated by the .) to check whether the action is enabled. The ! prefix reverts.", - "type": "string" - }, - "aclScope": { - "description": "A scope access to which is required for the action.", - "type": "string" - }, - "acl": { - "description": "An acl action access to which is required for the action.", - "type": "string", - "enum": [ - "create", - "read", - "edit", - "delete", - "stream" - ] + "anyOf": [ + {"const": "__APPEND__"}, + { + "$ref": "#/definitions/actionDefs" } - } + ] } }, "iconClass": { @@ -767,6 +750,99 @@ } }, "required": ["type"] + }, + "actionDefs": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "A name." + }, + "label": { + "type": "string", + "description": "A translatable label." + }, + "handler": { + "type": "string", + "description": "A handler class for the action." + }, + "initFunction": { + "type": "string", + "description": "An init function of the handler." + }, + "checkVisibilityFunction": { + "type": "string", + "description": "The handler function that checks whether the action is available. Should return a boolean value. Called on model sync." + }, + "configCheck": { + "description": "A config path (separated by the .) to check whether the action is enabled. The ! prefix reverts.", + "type": "string" + }, + "aclScope": { + "description": "A scope access to which is required for the action.", + "type": "string" + }, + "acl": { + "description": "An acl action access to which is required for the action.", + "type": "string", + "enum": [ + "create", + "read", + "edit", + "delete", + "stream" + ] + } + } + }, + "accessDataList": { + "type": "array", + "description": "Frontend access rules.", + "items": { + "type": "object", + "properties": { + "action": { + "enum": [ + "create", + "read", + "edit", + "stream", + "delete" + ], + "description": "An ACL action to check." + }, + "scope": { + "type": "string", + "description": "A scope to check." + }, + "portalIdList": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A portal ID list. To check whether a user in one of portals." + }, + "teamIdList": { + "type": "array", + "items": { + "type": "string" + }, + "description": "A team ID list. To check whether a user in one of teams." + }, + "isPortalOnly": { + "type": "boolean", + "description": "Allow for portal users only." + }, + "inPortalDisabled": { + "type": "boolean", + "description": "Disable for portal users." + }, + "isAdminOnly": { + "type": "boolean", + "description": "Allow for admin users only." + } + } + } } } } diff --git a/schema/metadata/components/accessDataList.json b/schema/metadata/components/accessDataList.json deleted file mode 100644 index 5b760b6271..0000000000 --- a/schema/metadata/components/accessDataList.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://www.espocrm.com/schema/metadata/components/accessDataList.json", - "title": "components/accessDataList", - "description": "Frontend access rules.", - "type": "array", - "items": { - "type": "object", - "properties": { - "action": { - "enum": [ - "create", - "read", - "edit", - "stream", - "delete" - ], - "description": "An ACL action to check." - }, - "scope": { - "type": "string", - "description": "A scope to check." - }, - "portalIdList": { - "type": "array", - "items": { - "type": "string" - }, - "description": "A portal ID list. To check whether a user in one of portals." - }, - "teamIdList": { - "type": "array", - "items": { - "type": "string" - }, - "description": "A team ID list. To check whether a user in one of teams." - }, - "isPortalOnly": { - "type": "boolean", - "description": "Allow for portal users only." - }, - "inPortalDisabled": { - "type": "boolean", - "description": "Disable for portal users." - }, - "isAdminOnly": { - "type": "boolean", - "description": "Allow for admin users only." - } - } - } -} diff --git a/schema/metadata/dashlets.json b/schema/metadata/dashlets.json index 51d3713139..80db3b978f 100644 --- a/schema/metadata/dashlets.json +++ b/schema/metadata/dashlets.json @@ -14,8 +14,7 @@ "description": "A scope access to which is required to have access to the dashlet.", }, "accessDataList": { - "$ref": "./components/accessDataList.json", - "description": "Frontend access rules." + "$ref": "./clientDefs.json#/definitions/accessDataList" }, "options": { "type": "object", diff --git a/schema/metadata/fields.json b/schema/metadata/fields.json index 7c4838fd35..5f92a0038b 100644 --- a/schema/metadata/fields.json +++ b/schema/metadata/fields.json @@ -33,21 +33,26 @@ "type": "array", "description": "Field parameters.", "items": { - "allOf": [ + "anyOf": [ + {"const": "__APPEND__"}, { - "$ref": "./entityDefs.json#/definitions/fieldDefs" - }, - { - "properties": { - "hidden": { - "type": "boolean", - "description": "Do not display the parameter in the field manager." + "allOf": [ + { + "$ref": "./entityDefs.json#/definitions/fieldDefs" }, - "name": { - "type": "string", - "description": "A name." + { + "properties": { + "hidden": { + "type": "boolean", + "description": "Do not display the parameter in the field manager." + }, + "name": { + "type": "string", + "description": "A name." + } + } } - } + ] } ] } diff --git a/schema/metadata/integrations.json b/schema/metadata/integrations.json index 0daebe921c..dc75960db2 100644 --- a/schema/metadata/integrations.json +++ b/schema/metadata/integrations.json @@ -33,7 +33,10 @@ "externalAccountSecretAttributeList": { "type": "array", "items": { - "type": "string" + "anyOf": [ + {"const": "__APPEND__"}, + {"type": "string"} + ] }, "description": "External account attributes to be hidden from the front-end." } diff --git a/schema/metadata/pdfDefs.json b/schema/metadata/pdfDefs.json index 88cc514c78..1f56505f29 100644 --- a/schema/metadata/pdfDefs.json +++ b/schema/metadata/pdfDefs.json @@ -8,7 +8,10 @@ "dataLoaderClassNameList": { "type": "array", "items": { - "type": "string" + "anyOf": [ + {"const": "__APPEND__"}, + {"type": "string"} + ] }, "description": "List of classes that loads additional data for PDF. Classes should implement the interface Espo\\Tools\\Pdf\\DataLoader. Use __APPEND__ for extending." } diff --git a/schema/metadata/scopes.json b/schema/metadata/scopes.json index a2a73f69c4..b4211522ec 100644 --- a/schema/metadata/scopes.json +++ b/schema/metadata/scopes.json @@ -219,11 +219,11 @@ "type": "boolean" }, "customizable": { - "description": "Wether the entity can be customized in the Entity Manager tool.", + "description": "Weather the entity can be customized in the Entity Manager tool.", "type": "boolean" }, "isCustom": { - "description": "Entities creted in the Entity Manager tool marked as custom.", + "description": "Entities created in the Entity Manager tool marked as custom.", "type": "boolean" }, "notifications": { @@ -260,11 +260,11 @@ } }, "languageIsGlobal": { - "description": "Languge labels will be available for all users (not restricted by ACL).", + "description": "Language labels will be available for all users (not restricted by ACL).", "type": "boolean" }, "languageAclDisabled": { - "description": "Disables access control application for language labels. All labels of the scope will be avaialble in the front-end regardless of user roles.", + "description": "Disables access control application for language labels. All labels of the scope will be available in the front-end regardless of user roles.", "type": "boolean" }, "hasPersonalData": {