SuperAPI AI Directory

role-compile

Coding & development

View repository

Updated 10-15 17:18

About this skill

/role-compile — generating a 1C role from JSON DSL

Accepts a JSON role definition → generates Roles/Имя.xml (metadata) and Roles/Имя/Ext/Rights.xml (rights). UUID automatically.

Parameters and command

Parameter Description
JsonPath Path to the JSON role definition
RolesDir Directory Roles/ in the configuration sources
powershell.exe -NoProfile -File .claude/skills/role-compile/scripts/role-compile.ps1 -JsonPath "<json>" -OutputDir "<RolesDir>"

<Role>ИмяРоли</Role> is automatically added to <ChildObjects> of the file Configuration.xml (expected in the parent of RolesDir).

JSON DSL

Structure

{ "name": "ИмяРоли", "synonym": "Отображаемое имя", "objects": [...], "templates": [...] }

Optional: comment (""), setForNewObjects (false), setForAttributesByDefault (true), independentRightsOfChildObjects (false).

Shorthand strings and object form

"objects": [
  "Catalog.Номенклатура: @view",
  "Document.Реализация: @edit",
  "DataProcessor.Загрузка: @view",
  "InformationRegister.Цены: Read, Update",
  { "name": "Document.Продажа", "preset": "view", "rights": {"Delete": false}, "rls": {"Read": "#Шаблон(\"\")"} }
]
  • Shorthand: "Тип.Имя: @пресет" or "Тип.Имя: Право1, Право2"
  • Object form: preset + rights (overrides) + rls (restrictions)

Presets

Preset Action
@view View — Read, View (+InputByString for catalogs/documents; Use+View for data processors/reports)
@edit Full editing — CRUD + Interactive* + Posting (documents)

@ is required in shorthand. In object form — "preset": "view" without @.

For services (WebService, HTTPService, IntegrationService) presets are not defined — use explicit rights: "WebService.Имя: Use".

Russian synonyms

Russian types are supported (Справочник→Catalog, Документ→Document) and rights (Чтение→Read, Просмотр→View). Mixing is allowed: "Справочник.Контрагенты: Чтение, View".

RLS templates

"templates": [{"name": "ДляОбъекта(Мод)", "condition": "ГДЕ Организация = &ТекОрг"}]

Reference in rls: "#ДляОбъекта(\"\")". The character & is automatically escaped in XML.

Examples

Simple role

{
  "name": "ЧтениеНоменклатуры", "synonym": "Чтение номенклатуры",
  "objects": ["Catalog.Номенклатура: @view", "Catalog.Контрагенты: @view", "DataProcessor.Загрузка: @view"]
}

Role with RLS

{
  "name": "ЧтениеДокументовПоОрганизации",
  "synonym": "Чтение документов (ограничение по организации)",
  "objects": [
    "Catalog.Организации: @view",
    {"name": "Document.РеализацияТоваровУслуг", "preset": "view", "rls": {"Read": "#ДляОбъекта(\"\")"}}
  ],
  "templates": [{"name": "ДляОбъекта(Модификатор)", "condition": "ГДЕ Организация = &ТекущаяОрганизация"}]
}

Detailed tables of presets, Russian synonyms and additional examples — in dsl-reference.md.

Verification

/role-validate <RightsPath> [MetadataPath]  — проверка корректности XML, прав, RLS
/role-info <RightsPath>                     — визуальная сводка структуры