docsartifacts

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: Apache-2.0, Apache-2.0 Imports: 1 Imported by: 0

README

DocShare module

Module key: docs.

DocShare shows fine-grained, per-file sharing. A file is a title plus a markdown body. Its creator owns it and can share it with individual company members as viewer or editor. Every read and write goes through the authorization engine's object-mode check on docs_document:<id>. The local docs.share table is only a read-side index and never decides access (see the header comment in service/store.go). There is deliberately no relation bridge from a file's viewer/editor tier to company_module#admin, so a file nobody shared with you stays unreadable, even to the platform superadmin (see the _comment in authz.fragment.json).

Layout

  • module.manifest.json, authz.fragment.json, openapi.yaml, migrations/: the module's contract artifacts.
  • service/: the Go HTTP service (cmd/ entrypoint, http.go routing and handlers, store.go data access, and authzclient.go/orgclient.go/notificationclient.go, thin wrappers over modulekit's clients for the platform's service-to-service APIs).
  • frontend/frontend.manifest.json: the routes/nav contract artifact. The React source lives under web/shell/src/modules/docs/, because the shell has no remote module loading yet (the notification and timesheet modules work the same way).

Authorization model

The fragment declares one object type, docs_document, with owner/editor/viewer relations (an owner is also an editor, and an editor is also a viewer) and a company_module tupleset pointer. docs.manage (module-level: audit trail, orphan cleanup) and docs.create (membership-gated) never grant read access to file content; authz.fragment.json's _comment explains why.

Running it

Run make migrate-docs after make migrate-registry (which creates the kiban_docs role in migrations/registry/0010_docs_role.sql and 0011_docs_audit_usage.sql). Then make dev or make test-stack-up starts the docs compose service with the rest of the stack.

Testing

  • go test ./modules/docs/...: Go tests, against a migrated stack (see service/dbtest_env_test.go).
  • npm run -w shell test: frontend unit tests in web/shell/test/modules/docs/.
  • npm run -w shell e2e: the full two-user Playwright journey in web/shell/e2e/docs.spec.ts.

Documentation

Overview

Package docsartifacts embeds the module's contract artifacts that a Go binary needs at compile time. The registry's install path needs the authz.fragment.json bytes to seed authz.model_fragment, and cmd/registry's container has no filesystem access to modules/ at runtime. The embed sits next to the artifact file so there is exactly one copy.

Index

Constants

This section is empty.

Variables

View Source
var AuthzFragmentJSON []byte
View Source
var ManifestJSON []byte

ManifestJSON is the module's module.manifest.json bytes, embedded for the same reason as AuthzFragmentJSON above. The registry's builtinModules literal reads version and metadata from this embed instead of hand-copying them, so they cannot drift from the manifest.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
AuthzClient talks to authz's real effective-access decision (POST /internal/authz/ effective-access/can and /batch-can, the pattern every module uses) plus the grants S2S surface (POST /internal/authz/grants, op:"grant"|"revoke") — this module's ONLY path to writing/removing authz tuples (modules never write authz.* tables directly).
AuthzClient talks to authz's real effective-access decision (POST /internal/authz/ effective-access/can and /batch-can, the pattern every module uses) plus the grants S2S surface (POST /internal/authz/grants, op:"grant"|"revoke") — this module's ONLY path to writing/removing authz tuples (modules never write authz.* tables directly).
cmd command
Command docs runs kiban-docs: the DocShare module service's HTTP API (fine-grained, per-document sharing).
Command docs runs kiban-docs: the DocShare module service's HTTP API (fine-grained, per-document sharing).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL