IAM tech spec: Auth and access management current state and proposed

changes.

Workspace support:
- Support for separate workspaces
- Addition of workspace CLI support for test purposes
- Massive test update
- Remove many 'user' references in services - workspace now provides
  the same separation
- Update API
This commit is contained in:
Cyber MacGeddon 2026-04-18 23:07:26 +01:00
parent 48da6c5f8b
commit 594deba73e
347 changed files with 6788 additions and 5540 deletions

View file

@ -12,8 +12,8 @@ from trustgraph.api import Api
from trustgraph.api.types import hash, Uri, Literal, Triple
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
default_user = 'trustgraph'
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
default_workspace = os.getenv("TRUSTGRAPH_WORKSPACE", "default")
from requests.adapters import HTTPAdapter
@ -656,11 +656,10 @@ documents = [
class Loader:
def __init__(
self, url, user, token=None
self, url, token=None, workspace="default",
):
self.api = Api(url, token=token).library()
self.user = user
self.api = Api(url, token=token, workspace=workspace).library()
def load(self, documents):
@ -689,10 +688,10 @@ class Loader:
print(" adding...")
self.api.add_document(
id = doc["id"], metadata = doc["metadata"],
user = self.user, kind = doc["kind"], title = doc["title"],
comments = doc["comments"], tags = doc["tags"],
document = content
id=doc["id"], metadata=doc["metadata"],
kind=doc["kind"], title=doc["title"],
comments=doc["comments"], tags=doc["tags"],
document=content,
)
print(" successful.")
@ -714,26 +713,26 @@ def main():
help=f'API URL (default: {default_url})',
)
parser.add_argument(
'-U', '--user',
default=default_user,
help=f'User ID (default: {default_user})'
)
parser.add_argument(
'-t', '--token',
default=default_token,
help='Authentication token (default: $TRUSTGRAPH_TOKEN)',
)
parser.add_argument(
'-w', '--workspace',
default=default_workspace,
help=f'Workspace (default: {default_workspace})',
)
args = parser.parse_args()
try:
p = Loader(
url=args.url,
user=args.user,
token=args.token,
workspace=args.workspace,
)
p.load(documents)