Implement Knowledge City platform, organizer and DAV integration
Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming. Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
This commit is contained in:
1 parent
288e6e94ac
commit
c1175d389f
699 files changed
+110197
-4117
No files matched your search
@@ -0,0 +1,43 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// CreateObjectInDomain records provenance atomically for the API's create,
|
||||
// save, then bind workflow. It does not turn globally unique Objects into
|
||||
// Domain-local identities, nor infer ownership of legacy unbound Objects.
|
||||
func (s *Store) CreateObjectInDomain(domainUUID, kind string) (string, error) {
|
||||
if err := s.ensureLocalDomain(domainUUID); err != nil {
|
||||
return "", err
|
||||
}
|
||||
id := uuid.NewString()
|
||||
tx, err := s.DB.Begin()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
if _, err := tx.Exec(`INSERT INTO objects(uuid,kind,created_at) VALUES(?,?,strftime('%s','now'))`, id, kind); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if _, err := tx.Exec(`INSERT INTO object_origins(object_uuid,domain_uuid,created_at) VALUES(?,?,strftime('%s','now'))`, id, domainUUID); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if err := tx.Commit(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return id, nil
|
||||
}
|
||||
|
||||
// ObjectInDomainAuthorityScope allows broad Domain grants only through a live
|
||||
// binding, or through recorded creation provenance while there are NO bindings.
|
||||
// Moving the last binding to another Domain never leaves source authority.
|
||||
func (s *Store) ObjectInDomainAuthorityScope(domainUUID, objectUUID string) (bool, error) {
|
||||
var allowed bool
|
||||
err := s.DB.QueryRow(`SELECT EXISTS(SELECT 1 FROM objects o WHERE o.uuid=? AND (
|
||||
EXISTS(SELECT 1 FROM paths p WHERE p.object_uuid=o.uuid AND p.domain_uuid=?) OR (
|
||||
NOT EXISTS(SELECT 1 FROM paths p WHERE p.object_uuid=o.uuid) AND
|
||||
EXISTS(SELECT 1 FROM object_origins x WHERE x.object_uuid=o.uuid AND x.domain_uuid=?))
|
||||
))`, objectUUID, domainUUID, domainUUID).Scan(&allowed)
|
||||
return allowed, err
|
||||
}
|
||||
Reference in new issue
Block a user