odant-work 1.0.97 → 1.0.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/#system/auto-update.json.4727984.tmp +15 -0
  2. package/#system/package-manifest.json +859 -863
  3. package/$server/$folder/$class/$data/handlers/pages/form/objects/$handler/class.js +26 -4
  4. package/$server/$folder/$class/$data/handlers/pages/form/objects/object/$handler/class.js +7 -2
  5. package/$server/$folder/$class/$domain/class.js +1 -0
  6. package/$server/$folder/$class/$module/handlers/pages/form/system/modules/$handler/class.js +1 -1
  7. package/$server/$folder/$class/$structure/$project/class.js +1 -0
  8. package/$server/$folder/$class/$structure/{handlers → $project/handlers}/pages/form/system/modules/$handler/class.js +21 -4
  9. package/$server/$folder/$class/$structure/$server/class.js +1 -0
  10. package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/license/$handler/class.js +1 -1
  11. package/$server/$folder/$class/$structure/$user/class.js +1 -0
  12. package/$server/$folder/$class/$structure/handlers/pages/data/$handler/class.js +14 -1
  13. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/class.js +34 -5
  14. package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js +28 -4
  15. package/$server/$folder/$class/$structure/handlers/pages/form/system/database/$handler/class.js +10 -6
  16. package/$server/$folder/$class/$structure/handlers/pages/form/system/messengers/$handler/class.js +41 -10
  17. package/$server/$folder/$class/$structure/handlers/pages/form/system/skills/$handler/class.js +27 -16
  18. package/$server/$folder/$class/$structure/handlers/pages/form/system/staff/$handler/class.js +19 -6
  19. package/$server/$folder/$class/ai/system.md +2 -2
  20. package/$server/$folder/$class/handlers/pages/form/folder/$handler/class.js +4 -1
  21. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js +7 -1
  22. package/$server/$folder/handlers/pages/form/$handler/class.js +14 -4
  23. package/$server/$folder/handlers/pages/form/folder/$handler/class.js +100 -2
  24. package/$server/$folder/handlers/readme.md +1 -1
  25. package/$server/$folder/lib/explorer/explorer.js +53 -8
  26. package/$server/$folder/lib/messenger-settings/messenger-settings.js +63 -21
  27. package/$server/$folder/lib/readme.md +0 -1
  28. package/$server/$folder/lib/tree/tree.js +67 -11
  29. package/AGENTS.md +2 -2
  30. package/PROJECTS/$domain/readme.md +2 -2
  31. package/package.json +1 -1
  32. package/sources/client/handler.js +4 -1
  33. package/sources/modules/agent/node-rules.js +5 -0
  34. package/sources/server/class/base-template.js +19 -81
  35. package/sources/server/class/security.js +19 -1
  36. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/modules/$handler/class.js +0 -3
  37. package/$server/$folder/$class/handlers/pages/form/system/files/$handler/class.js +0 -7
  38. package/$server/$folder/$class/handlers/pages/storage/$handler/class.js +0 -43
  39. package/$server/$folder/lib/file-viewer/file-viewer.js +0 -9
@@ -125,12 +125,28 @@ function isChatModelNode(f) {
125
125
  return true;
126
126
  }
127
127
 
128
- const SYSTEM_META_IDS = new Set(['class.js', 'readme.md', 'handlers', 'methods', 'triggers', 'timers', 'hooks', 'logs', 'DATA', 'INDEX']);
128
+ const SYSTEM_META_IDS = new Set(['class.js', 'readme.md', 'handlers', 'methods', 'triggers', 'timers', 'hooks', 'logs', 'DATA', 'INDEX', 'ai']);
129
129
 
130
- function applyTreeFilters(items, host) {
130
+ function isMetaNode(it) {
131
+ return Boolean(it && (it.isType || String(it.id || '')[0] === '$'));
132
+ }
133
+
134
+ function applyTreeFilters(items, host, parent = null) {
131
135
  items = items || [];
132
- if (host.hideSystem)
133
- items = items.filter(f => !f.isType && !(f.parent?.isType && SYSTEM_META_IDS.has(f.id)));
136
+ if (host.hideSystem) {
137
+ items = items.filter(f => {
138
+ if (!f || isMetaNode(f) || String(f.id || '')[0] === '#')
139
+ return false;
140
+ const inMetaRoot = Boolean(isMetaNode(parent) || isMetaNode(f.parent));
141
+ if (inMetaRoot) {
142
+ if (f instanceof CORE.$file || f.type === '$file')
143
+ return false;
144
+ if (SYSTEM_META_IDS.has(f.id))
145
+ return false;
146
+ }
147
+ return true;
148
+ });
149
+ }
134
150
  if (host.hideFiles)
135
151
  items = items.filter(f => !(f instanceof CORE.$file));
136
152
  if (host.onlyClasses)
@@ -165,7 +181,16 @@ export default {
165
181
  $list: ['tools', 'handlers', 'both']
166
182
  },
167
183
  /** фильтры системных типов */
168
- hideSystem: false,
184
+ hideSystem: {
185
+ $def: false,
186
+ set() {
187
+ for (const node of this._mountedNodes || [])
188
+ node?.invalidate?.('items', 'expanderIcon', 'knownHasItems');
189
+ if (this.$item)
190
+ this.getItems(this.$item, 1);
191
+ },
192
+ },
193
+ autoRun: true,
169
194
  hideFiles: false,
170
195
  onlyClasses: false, // только CORE.$class (site)
171
196
  onlyChatModels: false, // только языковые модели ($ai с поддержкой chat)
@@ -572,7 +597,7 @@ export default {
572
597
  // дети уже известны или их нет — заранее не грузим (стрелка — по hasItems, список — при раскрытии)
573
598
  if (deep < 1 && typeof $item?.DATA?.hasItems === 'boolean' && !Array.isArray($item[R]?.cache?.[this.itemsSelector]))
574
599
  return;
575
- let items = applyTreeFilters(await $item?.[this.itemsSelector], this);
600
+ let items = applyTreeFilters(await $item?.[this.itemsSelector], this, $item);
576
601
  // тот же фильтр, что у узла (oda-tree-node.items): вне отладки неадмину корень показывает только классы —
577
602
  // иначе предзагрузка тянет @items скрытых узлов (node_modules, USERS, файлов корня)
578
603
  if ($item?.type === '$server' && items instanceof Array && !WORK?.DEV_MODE && !(await $item.isBoss))
@@ -593,7 +618,25 @@ export default {
593
618
  return this.$item ? [this.$item] : [];
594
619
  },
595
620
  async nodeChildren(node) {
596
- return applyTreeFilters(Array.isArray(node?.[this.itemsSelector]) ? node[this.itemsSelector] : [], this);
621
+ return applyTreeFilters(Array.isArray(node?.[this.itemsSelector]) ? node[this.itemsSelector] : [], this, node);
622
+ },
623
+ $listeners: {
624
+ keydown(e) {
625
+ if (e.key !== 'Enter')
626
+ return;
627
+ const path = typeof e.composedPath === 'function' ? e.composedPath() : [e.target];
628
+ if (path.some(el => el && ['INPUT', 'TEXTAREA', 'SELECT'].includes(String(el.tagName || '').toUpperCase())))
629
+ return;
630
+ const target = this.focusedItem;
631
+ if (!target)
632
+ return;
633
+ e.preventDefault();
634
+ e.stopPropagation();
635
+ if (typeof this.execute === 'function')
636
+ this.execute(target);
637
+ else
638
+ target.execute?.();
639
+ },
597
640
  },
598
641
  runGlobalSearch() {
599
642
  const q = String(this.filter || '').trim();
@@ -622,7 +665,7 @@ ODA({is: 'oda-tree-node',
622
665
  :host {
623
666
  @apply --vertical;
624
667
  overflow: visible;
625
- padding: 0;
668
+ padding: 4px;
626
669
  min-width: 0;
627
670
  }
628
671
  .node {
@@ -715,12 +758,12 @@ ODA({is: 'oda-tree-node',
715
758
  padding: 0px;
716
759
  }
717
760
  </style>
718
- <div draggable="true" ~if="hideTops<1" class='node' ~class="{'node-focused': isFocused, 'is-stuck': isStuck, 'module-blocked': isModuleBlocked, 'large-icon-node': isLargeIconNode, 'medium-icon-node': isMediumIconNode, 'structure-only-node': isDepartmentNode}" :style="nodeStickyStyle" :category="isCategory" @tap="isCategory?$pdp.focusedItem=$pdp.focusedItem:$pdp.focusedItem = $item" @dragstart>
761
+ <div draggable="true" ~if="hideTops<1" class='node' ~class="{'node-focused': isFocused, 'is-stuck': isStuck, 'module-blocked': isModuleBlocked, 'large-icon-node': isLargeIconNode, 'medium-icon-node': isMediumIconNode, 'structure-only-node': isDepartmentNode}" :style="nodeStickyStyle" :category="isCategory" @tap="isCategory?$pdp.focusedItem=$pdp.focusedItem:$pdp.focusedItem = $item" @dblclick.stop="onNodeDblClick($event)" @dragstart>
719
762
  <oda-icon ~if="hideRoots<1" ~show="showExpander" :disabled="!expanderIcon" :icon="expanderIcon" :icon-size="expanderIconSize" @tap.stop="expanded = !expanded"></oda-icon>
720
763
  <div vertical flex style="min-width: 0; overflow: hidden;">
721
764
  <div horizontal flex style="min-width: 0; overflow: hidden; align-items: center;">
722
765
  <oda-icon ~show="showCheckbox" :disabled="!checkboxIcon || (isModule && $item?.DATA?.systemBlocked)" :icon="checkboxIcon" :icon-size="20" :title="moduleCheckboxTitle" @tap.stop="checked = !checked"></oda-icon>
723
- <item-node flex style="min-width: 0;" :expanded auto-run :show-users :show-size="showSize && !isCategory" :hide-icon="isCategory" :show-tools="isFocused && showTools" :menu-mode :$item :show-status @tap="setItemFocus">
766
+ <item-node flex style="min-width: 0;" :expanded :auto-run="$pdp.autoRun" :show-users :show-size="showSize && !isCategory" :hide-icon="isCategory" :show-tools="isFocused && showTools" :menu-mode :$item :show-status @tap="setItemFocus">
724
767
  <item-users ~if="isPlace" :$item="$item.owner" :place="$item.trail" :select-mode="false" :icon-size="20"></item-users>
725
768
  <span class="access" ~if="isLinkWrite">A</span>
726
769
  <span class="access" ~if="isLinkRead">R</span>
@@ -1103,7 +1146,20 @@ ODA({is: 'oda-tree-node',
1103
1146
  console.warn('[tree] set_enabled:', e?.message || e);
1104
1147
  }
1105
1148
  },
1149
+ onNodeDblClick(e) {
1150
+ if (this.isCategory || !this.$item)
1151
+ return;
1152
+ this.$pdp.focusedItem = this.$item;
1153
+ this.$pdp.focusedNode = this;
1154
+ if (this.$pdp.autoRun === false) {
1155
+ if (typeof this.$pdp.execute === 'function')
1156
+ this.$pdp.execute(this.$item);
1157
+ else
1158
+ this.$item.execute?.();
1159
+ }
1160
+ },
1106
1161
  get items() {
1162
+ void this.$pdp?.hideSystem;
1107
1163
  if (this.isModuleBlocked)
1108
1164
  return Promise.resolve([]);
1109
1165
  if (this.$pdp?.cleanStructure && isMainTreeLeaf(this.$item))
@@ -1128,7 +1184,7 @@ ODA({is: 'oda-tree-node',
1128
1184
  return Promise.resolve(this.$item?.[sel]);
1129
1185
  };
1130
1186
  return loadRaw().then(async raw => {
1131
- let items = applyTreeFilters(raw, this.$pdp);
1187
+ let items = applyTreeFilters(raw, this.$pdp, this.$item);
1132
1188
  if (this.$item?.type === '$server') {
1133
1189
  const isRootBoss = Boolean(WORK?.DEV_MODE || await this.$item.isBoss);
1134
1190
  if (this.$pdp?.tree)
package/AGENTS.md CHANGED
@@ -32,11 +32,11 @@
32
32
 
33
33
  - **Дерево и типы:** всё — папка или файл единого дерева; адрес узла — его путь. Папка с метапапкой `$тип` — класс: `class.js` (свойства), `readme.md` (контракт), `handlers/`. Ветки типов: `$structure` (кто действует: `$server`, `$project`, `$structure`, `$user`), `$module` (что установлено, в т. ч. `$mcp` и `$provider` с моделями `$ai`), `$data` (где хранятся объекты); `$class` абстрактен. `/X/~/…` отдаёт собранное по слоям: `/X/~/class.js`, `/X/~/readme.md`, `/X/~/handlers/…`.
34
34
  - **Ссылки:** только `ancestor` (узел продолжает другой) и `types` (примеси) в `class.js`; из пути ничего не вычисляется.
35
- - **Роли:** встроенная одна — `BOSS` (владелец узла и поддерева, наследуется вниз). Остальные — записи `#security.ROLES` структуры (`assign`, права `LINKS` `read`/`write`, маркеры `USERS`/`GUESTS`), а не дочерние классы.
35
+ - **Роли:** встроенная одна — `BOSS` (единственный владелец узла и поддерева на `$server`, `$project` и `$structure`, наследуется вниз). Остальные — записи `#security.ROLES` только подразделений `$structure` (`USERS`, права `LINKS`, маркер `external`), а не дочерние классы.
36
36
  - **Учёт:** `$catalog` (листья хранят объекты, группы агрегируют), `$virtual` (`turnover`/`balance` + `OVERLAY`), `$struct` (`table: true` — таблица), `$operation` — двойная запись (Дебет + Кредит в `$account` + `logs`); проведённое исправляется только сторно; поля справочника-аналитики — субаналитики.
37
37
  - **Ядро и дерево:** ядро (`sources/`, `oda/`, `run.mjs`, `#system/`) меняется только по явной задаче доработки движка через `developer`-контур (тесты, отложенный перезапуск). Остальное — дерево, включая системный типизатор `/$server/$folder`; оно меняется штатно, без git. Правки типизатора и модулей уровня WORK — только извне проектов, с подтверждением, проверкой последствий и сбросом кэша.
38
38
  - **Арены инструментов:** дерево — WORK-инструментами (`ls/read/find/write/edit/delete`, `create_class/update_class/move_class/delete_class`), файлы ОС вне WORK — `os_*`; `shell` не служит обходом WORK-ограничений.
39
- - **Интерфейс:** три базовые страницы (`explorer` в `$structure`, `storage` в `$class`, `form` в `$folder` — единый `work-form`). Представления и суб-представления — дерево `$handler` в `handlers/pages/form/<view>[/<subview>]/$handler/class.js` (без `tabs/` и без `<имя>.js`: метаданные и `component` в одном `class.js`). Штатные компоненты (`form/objects`, `form/objects/object`, `oda-packets`, `item-class-picker`) не дублируются; дерево `#formClassTree` включается по `objects: true`.
39
+ - **Интерфейс:** две базовые страницы (`explorer` в `$structure`, `form` в `$folder` — единый `work-form`, включая вкладку `form/folder` для `$class` и потомков с режимом «Показать системные» для `BOSS`). Представления и суб-представления — дерево `$handler` в `handlers/pages/form/<view>[/<subview>]/$handler/class.js` (без `tabs/` и без `<имя>.js`: метаданные и `component` в одном `class.js`). Штатные компоненты (`form/objects`, `form/objects/object`, `oda-packets`, `item-class-picker`) не дублируются; дерево `#formClassTree` включается по `objects: true`.
40
40
  - **Правило изменений:** новая возможность — файл или папка в нужном типе плюс штатное наследование. Не выражается так — спецслучай не делай, принеси пользователю развилку.
41
41
 
42
42
  ## Память и делегирование
@@ -1,5 +1,5 @@
1
1
  # Раздел «Проекты» (`/PROJECTS`)
2
2
 
3
- Домен верхнего уровня для управления проектами (`$project`).
3
+ Домен верхнего уровня для управления проектами и организациями (`$project`).
4
4
 
5
- В отличие от организаций (`/PROJECTS`, тип `$base`), в проектах (`$project`) нет иерархии подразделений (`$structure`) — рабочие места и роли участников (`#security.ROLES`) с доступом к данным (`LINKS`) настраиваются непосредственно в самом проекте. Каждый проект имеет собственное файловое пространство, чат, задачи `.task` и изолированную базу данных `PROJECTS/<Проект>/$project/#system/work.db`.
5
+ В проектах (`$project`) назначается единственный руководитель (`BOSS`), подключаются прикладные классы и модули (`MODULES`), а также ведётся изолированная база данных `PROJECTS/<Проект>/$project/#system/work.db`. Иерархия подразделений (`$structure`) с прикладными ролями и назначением пользователей (`#security.ROLES`) размещается внутри проекта.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odant-work",
3
- "version": "1.0.97",
3
+ "version": "1.0.99",
4
4
  "description": "ODANT-WORK — платформа цифровой организации (встроенная система учёта, документооборот, управление процессами и приватный мультимодальный ИИ)",
5
5
  "type": "module",
6
6
  "main": "sources/work.js",
@@ -68,7 +68,10 @@ export class $handler extends $class{
68
68
  _baseImportPath(item = this) {
69
69
  const p = String(item?.path || '');
70
70
  const s = String(item?.short || '');
71
- if (p.startsWith('/$server/$folder/'))
71
+ const ctxShort = String(item?.$context?.short || '').replace(/\/+$/, '');
72
+ if (ctxShort && ctxShort !== '/' && (s.startsWith('/~/') || p.startsWith('/~/')))
73
+ return ctxShort + (s.startsWith('/~/') ? s : p);
74
+ if (p && !p.startsWith('/~/'))
72
75
  return p;
73
76
  return s || p;
74
77
  }
@@ -1150,8 +1150,11 @@ export async function listNodeTasks(storage, params = {}) {
1150
1150
  */
1151
1151
  export async function saveNodeSecurity(storage, params = {}) {
1152
1152
  await assertBoss(storage, params);
1153
+ await storage.init;
1153
1154
  const post = (typeof params.post === 'string' ? JSON.parse(params.post) : params.post) || params;
1154
1155
  const rawSec = post.security && typeof post.security === 'object' ? post.security : post;
1156
+ if (storage?.DATA?.allowRoles === false && Array.isArray(rawSec.ROLES) && rawSec.ROLES.length > 0)
1157
+ throw new Error('Прикладные роли (ROLES) и назначение пользователей задаются только в подразделениях');
1155
1158
  const bossArr = Array.isArray(rawSec.BOSS)
1156
1159
  ? rawSec.BOSS.filter(v => typeof v === 'string' && v.trim()).slice(0, 1)
1157
1160
  : [];
@@ -1159,6 +1162,8 @@ export async function saveNodeSecurity(storage, params = {}) {
1159
1162
  ...rawSec,
1160
1163
  BOSS: bossArr,
1161
1164
  };
1165
+ if (storage?.DATA?.allowRoles === false)
1166
+ delete nextSec.ROLES;
1162
1167
  await saveOwnClassFields(storage, params, { '#security': nextSec });
1163
1168
  try {
1164
1169
  const LINKS = await import('../../server/access/links.js');
@@ -98,28 +98,7 @@ export function buildBasePassportClassJs({
98
98
  icon: 'fontawesome:s-building',
99
99
  };
100
100
 
101
- if (preset === 'standard' || preset === 'demo') {
102
- obj['#security'] = {
103
- ...(bossArr.length ? { BOSS: bossArr } : {}),
104
- ROLES: [
105
- {
106
- id: 'heads',
107
- label: 'Руководство',
108
- USERS: ['USERS'],
109
- LINKS: [
110
- { id: `${regPrefix}/CATALOGS`, access: 'read' },
111
- { id: `${regPrefix}/OPERATIONS`, access: 'read', scope: 'all' },
112
- { id: `${regPrefix}/REGISTER`, access: 'read', scope: 'all' },
113
- ],
114
- ROLES: [
115
- { id: 'ceo', label: 'Директор' },
116
- { id: 'deputies', label: 'Заместители' },
117
- ],
118
- },
119
- ],
120
- };
121
- }
122
- else if (bossArr.length) {
101
+ if (bossArr.length) {
123
102
  obj['#security'] = { BOSS: bossArr };
124
103
  }
125
104
 
@@ -141,7 +120,7 @@ export function buildTemplateDepartments(orgId) {
141
120
  ROLES: [{
142
121
  id: 'head',
143
122
  label: 'Генеральный директор',
144
- USERS: ['USERS'],
123
+ USERS: [],
145
124
  LINKS: [
146
125
  { id: `${P}/CATALOGS`, access: 'read' },
147
126
  { id: `${P}/CATALOGS/Договоры`, access: 'delete' },
@@ -153,7 +132,7 @@ export function buildTemplateDepartments(orgId) {
153
132
  ROLES: [{
154
133
  id: 'deputy',
155
134
  label: 'Исполнительный директор',
156
- USERS: ['USERS'],
135
+ USERS: [],
157
136
  LINKS: [
158
137
  { id: `${P}/CATALOGS`, access: 'read' },
159
138
  { id: `${P}/CATALOGS/Договоры`, access: 'create' },
@@ -174,7 +153,7 @@ export function buildTemplateDepartments(orgId) {
174
153
  ROLES: [{
175
154
  id: 'head',
176
155
  label: 'Главный бухгалтер',
177
- USERS: ['USERS'],
156
+ USERS: [],
178
157
  LINKS: [
179
158
  { id: `${P}/CATALOGS`, access: 'read' },
180
159
  { id: `${P}/CATALOGS/Субъекты`, access: 'delete' },
@@ -195,7 +174,7 @@ export function buildTemplateDepartments(orgId) {
195
174
  {
196
175
  id: 'accountant',
197
176
  label: 'Бухгалтер',
198
- USERS: ['USERS'],
177
+ USERS: [],
199
178
  LINKS: [
200
179
  { id: `${P}/CATALOGS`, access: 'read' },
201
180
  { id: `${P}/CATALOGS/Субъекты`, access: 'create' },
@@ -210,7 +189,7 @@ export function buildTemplateDepartments(orgId) {
210
189
  {
211
190
  id: 'cashier',
212
191
  label: 'Кассир',
213
- USERS: ['USERS'],
192
+ USERS: [],
214
193
  LINKS: [
215
194
  { id: `${P}/CATALOGS/Субъекты`, access: 'read' },
216
195
  { id: `${P}/CATALOGS/Сотрудники`, access: 'read' },
@@ -233,7 +212,7 @@ export function buildTemplateDepartments(orgId) {
233
212
  ROLES: [{
234
213
  id: 'head',
235
214
  label: 'Руководитель отдела продаж',
236
- USERS: ['USERS'],
215
+ USERS: [],
237
216
  LINKS: [
238
217
  { id: `${P}/CATALOGS/Субъекты`, access: 'delete' },
239
218
  { id: `${P}/CATALOGS/Клиенты`, access: 'delete' },
@@ -255,7 +234,7 @@ export function buildTemplateDepartments(orgId) {
255
234
  ROLES: [{
256
235
  id: 'manager',
257
236
  label: 'Менеджер по продажам',
258
- USERS: ['USERS'],
237
+ USERS: [],
259
238
  LINKS: [
260
239
  { id: `${P}/CATALOGS/Субъекты`, access: 'create' },
261
240
  { id: `${P}/CATALOGS/Клиенты`, access: 'create' },
@@ -284,7 +263,7 @@ export function buildTemplateDepartments(orgId) {
284
263
  ROLES: [{
285
264
  id: 'head',
286
265
  label: 'Руководитель закупок',
287
- USERS: ['USERS'],
266
+ USERS: [],
288
267
  LINKS: [
289
268
  { id: `${P}/CATALOGS/Субъекты`, access: 'delete' },
290
269
  { id: `${P}/CATALOGS/Поставщики`, access: 'delete' },
@@ -305,7 +284,7 @@ export function buildTemplateDepartments(orgId) {
305
284
  ROLES: [{
306
285
  id: 'buyer',
307
286
  label: 'Менеджер по закупкам',
308
- USERS: ['USERS'],
287
+ USERS: [],
309
288
  LINKS: [
310
289
  { id: `${P}/CATALOGS/Субъекты`, access: 'create' },
311
290
  { id: `${P}/CATALOGS/Поставщики`, access: 'create' },
@@ -331,7 +310,7 @@ export function buildTemplateDepartments(orgId) {
331
310
  ROLES: [{
332
311
  id: 'head',
333
312
  label: 'Заведующий складом',
334
- USERS: ['USERS'],
313
+ USERS: [],
335
314
  LINKS: [
336
315
  { id: `${P}/CATALOGS/Склады`, access: 'delete' },
337
316
  { id: `${P}/CATALOGS/Партии`, access: 'delete' },
@@ -354,7 +333,7 @@ export function buildTemplateDepartments(orgId) {
354
333
  ROLES: [{
355
334
  id: 'keeper',
356
335
  label: 'Кладовщик',
357
- USERS: ['USERS'],
336
+ USERS: [],
358
337
  LINKS: [
359
338
  { id: `${P}/CATALOGS/Склады`, access: 'create' },
360
339
  { id: `${P}/CATALOGS/Партии`, access: 'create' },
@@ -385,7 +364,7 @@ export function buildTemplateDepartments(orgId) {
385
364
  ROLES: [{
386
365
  id: 'head',
387
366
  label: 'Руководитель производства',
388
- USERS: ['USERS'],
367
+ USERS: [],
389
368
  LINKS: [
390
369
  { id: `${P}/CATALOGS/Номенклатура`, access: 'delete' },
391
370
  { id: `${P}/CATALOGS/Склады`, access: 'read' },
@@ -401,7 +380,7 @@ export function buildTemplateDepartments(orgId) {
401
380
  ROLES: [{
402
381
  id: 'master',
403
382
  label: 'Мастер производства',
404
- USERS: ['USERS'],
383
+ USERS: [],
405
384
  LINKS: [
406
385
  { id: `${P}/CATALOGS/Номенклатура`, access: 'read' },
407
386
  { id: `${P}/CATALOGS/Склады`, access: 'read' },
@@ -425,7 +404,7 @@ export function buildTemplateDepartments(orgId) {
425
404
  ROLES: [{
426
405
  id: 'head',
427
406
  label: 'Руководитель логистики',
428
- USERS: ['USERS'],
407
+ USERS: [],
429
408
  LINKS: [
430
409
  { id: `${P}/CATALOGS/Транспорт`, access: 'delete' },
431
410
  { id: `${P}/CATALOGS/Клиенты`, access: 'read' },
@@ -442,7 +421,7 @@ export function buildTemplateDepartments(orgId) {
442
421
  ROLES: [{
443
422
  id: 'dispatcher',
444
423
  label: 'Диспетчер',
445
- USERS: ['USERS'],
424
+ USERS: [],
446
425
  LINKS: [
447
426
  { id: `${P}/CATALOGS/Транспорт`, access: 'create' },
448
427
  { id: `${P}/CATALOGS/Клиенты`, access: 'read' },
@@ -467,7 +446,7 @@ export function buildTemplateDepartments(orgId) {
467
446
  ROLES: [{
468
447
  id: 'head',
469
448
  label: 'Руководитель службы персонала',
470
- USERS: ['USERS'],
449
+ USERS: [],
471
450
  LINKS: [
472
451
  { id: `${P}/CATALOGS/Субъекты/Физ. лица`, access: 'delete' },
473
452
  { id: `${P}/CATALOGS/Должности`, access: 'delete' },
@@ -481,7 +460,7 @@ export function buildTemplateDepartments(orgId) {
481
460
  ROLES: [{
482
461
  id: 'officer',
483
462
  label: 'Специалист по кадрам',
484
- USERS: ['USERS'],
463
+ USERS: [],
485
464
  LINKS: [
486
465
  { id: `${P}/CATALOGS/Субъекты/Физ. лица`, access: 'create' },
487
466
  { id: `${P}/CATALOGS/Должности`, access: 'create' },
@@ -538,48 +517,7 @@ export function buildProjectPassportClassJs({
538
517
  icon: 'carbon:rocket',
539
518
  };
540
519
 
541
- if (preset === 'standard' || preset === 'demo') {
542
- obj['#security'] = {
543
- ...(bossArr.length ? { BOSS: bossArr } : {}),
544
- ROLES: [
545
- {
546
- id: 'pm',
547
- label: 'Руководитель проекта',
548
- icon: 'fontawesome:s-user-tie',
549
- USERS: ['USERS'],
550
- LINKS: [
551
- { id: `${regPrefix}/CATALOGS`, access: 'delete' },
552
- { id: `${regPrefix}/OPERATIONS`, access: 'delete', scope: 'all' },
553
- { id: `${regPrefix}/REGISTER`, access: 'read', scope: 'all' },
554
- { id: `${geoPrefix}/Геоточки`, access: 'delete' },
555
- ],
556
- },
557
- {
558
- id: 'team',
559
- label: 'Исполнители проекта',
560
- icon: 'fontawesome:s-users',
561
- USERS: ['USERS'],
562
- LINKS: [
563
- { id: `${regPrefix}/CATALOGS`, access: 'read' },
564
- { id: `${regPrefix}/OPERATIONS`, access: 'create', scope: 'place' },
565
- { id: `${regPrefix}/REGISTER`, access: 'read', scope: 'place' },
566
- { id: `${geoPrefix}/Геоточки`, access: 'create' },
567
- ],
568
- },
569
- {
570
- id: 'stakeholders',
571
- label: 'Участники и заказчик',
572
- icon: 'fontawesome:s-eye',
573
- USERS: ['USERS'],
574
- LINKS: [
575
- { id: `${regPrefix}/CATALOGS`, access: 'read' },
576
- { id: `${regPrefix}/REGISTER`, access: 'read', scope: 'all' },
577
- ],
578
- },
579
- ],
580
- };
581
- }
582
- else if (bossArr.length) {
520
+ if (bossArr.length) {
583
521
  obj['#security'] = { BOSS: bossArr };
584
522
  }
585
523
 
@@ -740,14 +740,32 @@ export const classSecurityMethods = {
740
740
  },
741
741
 
742
742
  async allowAccess(params) {
743
+ const isSysSession = DEV_MODE || !params?.session || params.session.$user === globalThis.WORK;
743
744
  // Раздел /USERS ($users): виден внутренним сотрудникам и скрыт от внешних (external-only) и гостей
744
745
  if (this.type === '$users') {
745
- if (DEV_MODE || !params?.session || params.session.$user === globalThis.WORK)
746
+ if (isSysSession)
746
747
  return true;
747
748
  if (params?.session?.principal?.kind === 'node')
748
749
  return false;
749
750
  return this._hasInternalWorkRole(params);
750
751
  }
752
+ // Домен-контейнер (например /PROJECTS): виден только BOSS или при наличии хотя бы одного доступного потомка
753
+ await this.init;
754
+ if (this.DATA?.container === true && !this.hasAssignments()) {
755
+ if (isSysSession)
756
+ return true;
757
+ if (params?.session?.principal?.kind === 'node')
758
+ return false;
759
+ const uid = this.constructor.resolveUid(params);
760
+ if (uid && (await this.allBosses).some(u => u?.id === uid))
761
+ return true;
762
+ const items = await this.items;
763
+ for (const i of items) {
764
+ if (i instanceof FS.$class && await i.allowAccess(params))
765
+ return true;
766
+ }
767
+ return false;
768
+ }
751
769
  let result = await this.canSee(this, params);
752
770
  if (!result) {
753
771
  const items = await this.items;
@@ -1,7 +0,0 @@
1
- export default {
2
- ancestor: '/$server/$folder/handlers/pages/form/folder',
3
- label: 'Файлы',
4
- icon: 'fontawesome:r-folder-open',
5
- order: 90,
6
- default: false,
7
- };
@@ -1,43 +0,0 @@
1
- export default {
2
- icon: 'bootstrap:database-fill-gear',
3
- /** Хранилище — только роль BOSS. */
4
- roles: ['BOSS'],
5
- component: {
6
- imports: '~/lib//explorer.js',
7
- extends: 'item-explorer',
8
- hideTops: 0,
9
- hideRoots: 1,
10
- showSize: true,
11
- cleanStructure: false,
12
- itemsSelector: 'entries',
13
- _resolvedStorageFolder: null,
14
- async ready() {
15
- await this._switchToStorageFolder();
16
- },
17
- async attached() {
18
- await this._switchToStorageFolder();
19
- },
20
- $observers: {
21
- async _itemChanged($item) {
22
- if ($item && $item !== this._resolvedStorageFolder) {
23
- await this._switchToStorageFolder();
24
- }
25
- }
26
- },
27
- async _switchToStorageFolder() {
28
- const src = this.$item;
29
- if (!src || src === this._resolvedStorageFolder) return;
30
- this.$context = src;
31
- const sf = await src.storage_folder;
32
- if (sf && this.$item === src) {
33
- this._resolvedStorageFolder = sf;
34
- this.$item = sf;
35
- }
36
- },
37
- $public: {
38
- get allowUse() {
39
- return this.$item?.constructor?.name !== '$file';
40
- }
41
- }
42
- }
43
- };
@@ -1,9 +0,0 @@
1
- export default{
2
- imports: '~/lib//node.js',
3
- template:/* html */`
4
- <item-node ~for="files" :$item="$for.item"></item-node>
5
- `,
6
- get files(){
7
- return Promise.resolve(this.$item?.storage).then(s => s?.items);
8
- }
9
- }