odant-work 1.0.72 → 1.0.74

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 (27) hide show
  1. package/#system/package-manifest.json +29 -27
  2. package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/explorer.js +1 -1
  3. package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/calendar.js +1004 -1011
  4. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/class.js +7 -90
  5. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/email.js +913 -705
  6. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/methods/refresh/$method/class.js +30 -1
  7. package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/class.js +1 -1
  8. package/$server/$folder/$class/$structure/handlers/pages/form/system/$handler/tabs/staff.js +78 -5
  9. package/$server/$folder/$class/ai/skills/email-mailbox.md +10 -7
  10. package/$server/$folder/$class/ai/skills/meeting-minutes.md +1 -1
  11. package/$server/$folder/$file/$eml/triggers/on_save/$trigger/class.js +17 -1
  12. package/$server/$folder/lib/calendar-form/calendar-form.js +482 -296
  13. package/$server/$folder/lib/icon/icon.js +50 -0
  14. package/$server/$folder/lib/tree/tree.js +9 -7
  15. package/USERS/$users/class.js +4 -3
  16. package/oda/components/icon/icon.js +6 -1
  17. package/package.json +1 -1
  18. package/sources/host/email-utils.js +25 -1
  19. package/sources/modules/agent/index.js +3 -1
  20. package/sources/modules/agent/node-rules.js +51 -0
  21. package/sources/modules/agent/scheduler.js +7 -0
  22. package/sources/modules/agent/tools/calendar-mail.js +273 -0
  23. package/sources/server/access/gateway.js +3 -0
  24. package/sources/server/class/feed.js +46 -0
  25. package/sources/server/class/mail-calendar.js +867 -0
  26. package/sources/server/class/security.js +44 -0
  27. package/sources/server/folder.js +1 -1
@@ -647,7 +647,51 @@ export const classSecurityMethods = {
647
647
  }
648
648
  },
649
649
 
650
+ /** Есть ли у субъекта хотя бы одна внутренняя роль сотрудника (BOSS или USER), а не только CLIENT. */
651
+ async _hasInternalWorkRole(params = {}) {
652
+ if (DEV_MODE || !params?.session || params.session.$user === globalThis.WORK)
653
+ return true;
654
+ const uid = this.constructor.resolveUid(params);
655
+ if (!uid)
656
+ return false;
657
+ const rootRoles = await globalThis.WORK?.roles?.(params).catch(() => []) || [];
658
+ if (rootRoles.includes('BOSS') || rootRoles.includes('USER'))
659
+ return true;
660
+ const checkContainer = async (domainPath) => {
661
+ const dom = await globalThis.WORK?.get_item?.(domainPath).catch(() => null);
662
+ const roots = dom ? ((await Promise.resolve(dom.items).catch(() => [])) || []).filter(b => b && b.id?.[0] !== '$') : [];
663
+ const stack = roots.map(node => ({ node, depth: 0 }));
664
+ while (stack.length) {
665
+ const { node, depth } = stack.pop();
666
+ const r = await Promise.resolve(node.roles?.(params)).catch(() => []) || [];
667
+ if (r.includes('BOSS') || r.includes('USER'))
668
+ return true;
669
+ if (depth >= 5)
670
+ continue;
671
+ const sub = await Promise.resolve(node.items).catch(() => []) || [];
672
+ for (const s of sub) {
673
+ if (s?.type === '$structure' && s.id?.[0] !== '$')
674
+ stack.push({ node: s, depth: depth + 1 });
675
+ }
676
+ }
677
+ return false;
678
+ };
679
+ if (await checkContainer('/ORGANIZATIONS'))
680
+ return true;
681
+ if (await checkContainer('/PROJECTS'))
682
+ return true;
683
+ return false;
684
+ },
685
+
650
686
  async allowAccess(params) {
687
+ // Раздел /USERS ($users): виден сотрудникам (BOSS/USER) и скрыт от внешних клиентов (CLIENT-only) и гостей
688
+ if (this.type === '$users') {
689
+ if (DEV_MODE || !params?.session || params.session.$user === globalThis.WORK)
690
+ return true;
691
+ if (params?.session?.principal?.kind === 'node')
692
+ return false;
693
+ return this._hasInternalWorkRole(params);
694
+ }
651
695
  let result = await this.canSee(this, params);
652
696
  if (!result) {
653
697
  const items = await this.items;
@@ -2118,7 +2118,7 @@ export class $folder extends $item{
2118
2118
  }
2119
2119
 
2120
2120
  sortItems(files, reverse = false, isType = this.isType) {
2121
- const rootOrder = { ORGANIZATIONS: 0, PROJECTS: 1, MODULES: 2, MODELS: 3, NODES: 4, nodes: 4, SERVICES: 5, USERS: 6 };
2121
+ const rootOrder = { ORGANIZATIONS: 0, PROJECTS: 1, USERS: 2, MODULES: 3, MODELS: 4, NODES: 5, nodes: 5, SERVICES: 6 };
2122
2122
  const typeGroup = (t) => {
2123
2123
  if (t === '$catalog' || t === '$virtual' || t === '$struct' || t === '$operation' || t === '$register' || t === '$account')
2124
2124
  return 0;