Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tenant ecosystem management #201

Merged
merged 17 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/continuous-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,3 @@ jobs:
git pull
make stop_n_clean
./manage up-as-daemon

File renamed without changes.
154 changes: 0 additions & 154 deletions app/admin/governance/multitenant_wallet/wallet_admin.py

This file was deleted.

File renamed without changes.
52 changes: 52 additions & 0 deletions app/admin/tenants/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from typing import List, Optional
from aries_cloudcontroller.model.wallet_record import WalletRecord
from pydantic import BaseModel, Field, HttpUrl

from app.facades.trust_registry import TrustRegistryRole


class TenantRequestBase(BaseModel):
image_url: Optional[HttpUrl] = Field(
None, example="https://yoma.africa/images/sample.png"
)


class CreateTenantRequest(TenantRequestBase):
name: str = Field(..., example="Yoma") # used as label and trust registry name
TimoGlastra marked this conversation as resolved.
Show resolved Hide resolved
roles: Optional[List[TrustRegistryRole]] = None


class UpdateTenantRequest(TenantRequestBase):
name: Optional[str] = Field(
None, example="Yoma"
) # used as label and trust registry name
roles: Optional[List[TrustRegistryRole]] = None


class Tenant(BaseModel):
tenant_id: str = Field(..., example="545135a4-ecbc-4400-8594-bdb74c51c88d")
tenant_name: str = Field(..., example="Alice")
image_url: Optional[str] = Field(None, example="https://yoma.africa/image.png")
created_at: str = Field(...)
updated_at: Optional[str] = Field(None)


class TenantAuth(BaseModel):
access_token: str = Field(..., example="ey...")


class CreateTenantResponse(Tenant, TenantAuth):
pass


def tenant_from_wallet_record(wallet_record: WalletRecord) -> Tenant:
label: str = wallet_record.settings["default_label"]
image_url: Optional[str] = wallet_record.settings["image_url"]

return Tenant(
tenant_id=wallet_record.wallet_id,
tenant_name=label,
image_url=image_url,
created_at=wallet_record.created_at,
updated_at=wallet_record.updated_at,
)
Loading