Commit Graph

114 Commits

Author SHA1 Message Date
Jake Barnby b747c97561 fix(advisor): address review comments on scopes and schema
- Register dedicated reports.write scope and switch deleteReport to it
  so cloud can issue narrowly-scoped delete keys without granting
  insights.write.
- Make insights.parentResourceInternalId optional with null default to
  match its companion parentResourceType/parentResourceId fields and
  unblock insights with no parent (e.g. database-level performance
  insights).
- Tighten Insight.reportId model description: insights always belong to
  a report, ad-hoc insights are not supported.
- Add reports.write to default test API key and admin role so existing
  e2e tests using serverHeaders() can hit the delete endpoint.
- Bump APP_CACHE_BUSTER for the schema change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 12:18:39 +12:00
copilot-swe-agent[bot] 6d0eab2583 refactor(advisor): make insights API read-only in CE
Agent-Logs-Url: https://github.com/appwrite/appwrite/sessions/8d7897b5-ac68-487d-954a-be717380bf66

Co-authored-by: abnegate <5857008+abnegate@users.noreply.github.com>
2026-05-08 06:07:23 +00:00
Jake Barnby 6c6782dd28 Merge remote-tracking branch 'origin/1.9.x' into pr-12194-feat-insights-module
# Conflicts:
#	app/config/scopes/project.php
2026-05-06 20:33:40 +12:00
Jake Barnby 00565ea471 refactor(insights): metadata-only CTAs, platform DB, reports parent
Address review feedback on PR #12194:

- Pivot CTAs to pure descriptors (id/label/action/params). Drop the
  server-side execution layer: Action interface, registry, the
  databases.indexes.create CTA action, the params validator, the
  /v1/insights/:id/ctas/:id/executions endpoint, the InsightCTAExecution
  model, the INSIGHT_CTA_* errors, and the corresponding events. The
  console invokes the existing public API directly with the descriptor's
  action + params.

- Restore Databases\Indexes\Action.php to its pre-CTA shape and inline
  the index-create body back into Create.php (the createIndex helper
  was added solely for CTA reuse).

- Move insights collection from project DB to platform DB and add a
  parent reports collection alongside it. Insights carry projectId /
  projectInternalId for tenant scoping and an optional reportId for
  grouping. List endpoints filter by projectInternalId; Get/Update/
  Delete also enforce project ownership before touching the document.

- New Reports module with full CRUD (Create/Get/XList/Update/Delete),
  Report response model, Reports query validator, REPORT_NOT_FOUND /
  REPORT_ALREADY_EXISTS errors, reports.read / reports.write scopes,
  and reports.* event tree. Delete cascades to child insights.

- Update.php now mutates the loaded document via setAttribute (instead
  of passing a partial new Document), reuses CTAsValidator (instead of
  the looser ArrayList<JSON> + isset check), and rejects duplicate CTA
  ids.

- Create.php enforces unique CTA ids during normalization.

- CTAsValidator gained a configurable maxCount (default 16) so the
  Create path matches the Update path and the DB column size, and
  oversized payloads return a clean 400.

- Validator\Queries\Insights adds status and reportId to
  ALLOWED_ATTRIBUTES so dismissal / report workflows are filterable.

- Realtime channel parser guards $parts[1] for both insights and
  reports event names.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 13:46:07 +12:00
Matej Bačo b0220292a7 Rename policies to prevent double scope usease 2026-05-05 12:58:06 +02:00
Jake Barnby e1ddcd051c feat(insights): add schema, scopes, events, errors, constants
Wires the platform glue for insights: the `insights` collection on the
project database, the `insights.read` / `insights.write` scopes, the
`insights.[insightId]` event tree (including the nested `ctas.[ctaId].trigger`
event), the typed exceptions, and the runtime CTA registry resource.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 12:40:28 +12:00
Matej Bačo aaf91f3816 Improve scopes quality 2026-04-29 13:52:13 +02:00
Matej Bačo 93f7a0d902 GitHub oauth endpoint 2026-04-24 11:17:18 +02:00
Matej Bačo bdbc5b92df Fix after code review 2026-04-23 13:47:31 +02:00
Matej Bačo 9065d9ada4 Add mocks scopes 2026-04-22 12:13:10 +02:00
Matej Bačo 0d27c59cb8 Merge branch '1.9.x' into feat-public-project-policies 2026-04-22 09:57:48 +02:00
Matej Bačo 5f9dc0fcd8 Req & res filters, review fixes 2026-04-21 13:58:36 +02:00
Matej Bačo 489b2c4e21 Add new scopes 2026-04-17 16:45:04 +02:00
Matej Bačo ba94bff8d4 Public project variables API 2026-03-18 14:48:31 +01:00
Prem Palanisamy 3fde05e024 Add resource validation, admin scopes, and events for schedules 2026-02-18 06:23:19 +00:00
Matej Bačo 7dea3f19a9 Add scopes for devkeys 2025-12-18 12:31:00 +01:00
Damodar Lohani dff7aa6ce0 format 2025-11-04 07:12:42 +00:00
Damodar Lohani 437d914e90 More refactor and fixes 2025-11-04 06:08:35 +00:00
Jake Barnby ddde13a78f Revert "Merge pull request #10468 from appwrite/feat-apps-module-dl"
This reverts commit 9dd1939d1f, reversing
changes made to 8dfdfcb522.

# Conflicts:
#	app/config/collections/common.php
#	app/controllers/api/users.php
#	app/init/resources.php
#	composer.lock
2025-10-21 14:59:30 +13:00
Damodar Lohani d56dff954f Merge remote-tracking branch 'origin/1.8.x' into feat-apps-module-dl 2025-10-12 00:34:07 +00:00
Jake Barnby 4a3cbdafca Move to row-level scope for txn 2025-09-25 17:59:39 +12:00
Jake Barnby 42d981c0ef Add scopes to roles 2025-09-16 13:15:08 +12:00
Damodar Lohani 2be8895dfd Merge remote-tracking branch 'origin/1.8.x' into feat-apps-module-dl 2025-09-10 03:56:34 +00:00
Jake Barnby 93cc4e1df8 Merge remote-tracking branch 'origin/1.8.x' into feat-txn
# Conflicts:
#	app/config/errors.php
#	app/config/roles.php
#	app/controllers/api/databases.php
#	composer.json
#	composer.lock
#	src/Appwrite/Extend/Exception.php
#	src/Appwrite/Utopia/Response.php
#	tests/e2e/Services/Databases/Legacy/DatabasesBase.php
2025-07-29 22:16:56 +12:00
Darshan 789064e295 add: new scopes to the api. 2025-06-25 11:29:45 +05:30
Jake Barnby b556846be3 Add txn roles 2025-06-17 16:01:39 -04:00
Eldad Fux fb29fe7b3c Merge remote-tracking branch 'origin/1.7.x' into feat-apps-module 2025-04-29 20:12:31 +02:00
Chirag Aggarwal 6d0d15f469 Merge branch '1.7.x' into feat-tokens-module 2025-04-18 16:01:06 +00:00
Eldad Fux 477add3022 Formatting 2025-03-17 21:49:10 +01:00
Eldad Fux 8aa5714173 cleanups 2025-03-17 21:44:31 +01:00
Khushboo Verma 7be0f4a193 Add rules.read scope to console member 2025-01-29 14:56:01 +05:30
Khushboo Verma 86bc775791 Add sites resource type and logs scope 2024-11-29 18:57:10 +05:30
Damodar Lohani d32dc0a4d9 tokens test and scopes 2024-11-18 08:52:16 +00:00
Khushboo Verma 08630cd686 Add timeout and add sites scopes 2024-10-26 11:01:14 +02:00
Torsten Dittmann 5f15c34ad5 Merge branch 'feat-console-roles-dl' of https://github.com/appwrite/appwrite into migrations-backups 2024-09-27 14:55:57 +02:00
Damodar Lohani 70bf8e2c41 fix project scope 2024-09-05 03:47:58 +00:00
Damodar Lohani 72d720f83e remove projects.write from user scope 2024-09-05 03:20:19 +00:00
Damodar Lohani bc5ac28b84 update validator and formatting 2024-09-04 02:01:56 +00:00
fogelito 964be49c3a revert roles.php 2024-09-02 10:26:03 +03:00
fogelito 79fd72ead4 Add backups scopes 2024-09-01 13:13:06 +03:00
Damodar Lohani 1ca4904132 reset auth and roles 2024-08-21 05:14:17 +00:00
Christy Jacob 3b7ce7691e feat: add support for console role 2024-07-23 23:49:11 +04:00
Christy Jacob 1bbce77c92 chore: poc for new roles 2024-07-18 01:18:15 +04:00
loks0n fa28496b32 feat: ssr dx changes 2024-02-20 11:45:11 +00:00
loks0n 0092af7ac6 chore: rename new scopes 2024-01-17 11:17:03 +00:00
loks0n 5c803f6eff Merge branch '1.5.x' of https://github.com/appwrite/appwrite into feat-ssr 2024-01-08 11:41:55 +00:00
loks0n 0e25d3e1df fix: scopes 2023-12-13 10:25:20 +00:00
loks0n 453c1928ee fix: teams tests 2023-12-11 20:56:59 +00:00
loks0n 830544e245 fix: logged in ssr cases 2023-11-15 11:57:27 +00:00
loks0n af0d689aff feat: sessions scope 2023-10-31 15:05:02 +00:00