diff --git a/plugins/traction_innkeeper/traction_innkeeper/v1_0/tenant/routes.py b/plugins/traction_innkeeper/traction_innkeeper/v1_0/tenant/routes.py index eaf84cdbb..4a9b4a989 100644 --- a/plugins/traction_innkeeper/traction_innkeeper/v1_0/tenant/routes.py +++ b/plugins/traction_innkeeper/traction_innkeeper/v1_0/tenant/routes.py @@ -1,6 +1,7 @@ import logging from aiohttp import web +from aiohttp.web_middlewares import middleware from aiohttp_apispec import ( docs, match_info_schema, @@ -22,6 +23,7 @@ WalletRecordSchema, WalletRecord, ) +from aries_cloudagent.admin import server from marshmallow import fields, validate from ..innkeeper.routes import ( @@ -85,6 +87,9 @@ class TenantLedgerIdConfigSchema(OpenAPISchema): async def setup_tenant_context(request: web.Request, handler): """Middle ware to extract tenant_id and provide it to log formatter + In addition this will also ensure tenants are not suspended before + accessing endpoints. + This middleware is appended to the app middlewares and therefore runs last. At this point the wallet_id has been extracted from a previous middleware function and is used to query the tenant record. @@ -103,6 +108,9 @@ async def setup_tenant_context(request: web.Request, handler): rec = await TenantRecord.query_by_wallet_id(session, wallet_id) LOGGER.debug(rec) tenant_id = rec.tenant_id + # Ensure tokens are not associated with suspended tenants + if TenantRecord.STATE_DELETED == rec.state: + raise web.HTTPUnauthorized(reason="Tenant Is Suspended") log_records_inject(tenant_id) diff --git a/services/tenant-ui/frontend/src/components/innkeeper/tenants/Tenants.vue b/services/tenant-ui/frontend/src/components/innkeeper/tenants/Tenants.vue index 89691cc86..2f0fc516e 100644 --- a/services/tenant-ui/frontend/src/components/innkeeper/tenants/Tenants.vue +++ b/services/tenant-ui/frontend/src/components/innkeeper/tenants/Tenants.vue @@ -20,9 +20,9 @@
- {{ $t('common.deleted') }} + {{ $t('common.suspended') }} @@ -137,10 +137,10 @@ @@ -186,13 +186,13 @@ import RowExpandData from '@/components/common/RowExpandData.vue'; const toast = useToast(); const innkeeperTenantsStore = useInnkeeperTenantsStore(); -const showDeleted = ref(false); +const showSuspended = ref(false); // Populating the Table const { loading, tenants } = storeToRefs(useInnkeeperTenantsStore()); const loadTable = () => { innkeeperTenantsStore - .listTenants(showDeleted.value ? 'all' : 'active') + .listTenants(showSuspended.value ? 'all' : 'active') .catch((err: string) => { console.error(err); toast.error(`Failure: ${err}`); diff --git a/services/tenant-ui/frontend/src/plugins/i18n/locales/en.json b/services/tenant-ui/frontend/src/plugins/i18n/locales/en.json index 7b76eb33e..3374d377a 100644 --- a/services/tenant-ui/frontend/src/plugins/i18n/locales/en.json +++ b/services/tenant-ui/frontend/src/plugins/i18n/locales/en.json @@ -58,15 +58,13 @@ "credentialId": "Credential ID", "credentials": "Credentials", "decodedJwt": "Decoded JWT", - "deleted": "Deleted", - "deletedAt": "Deleted At", "developer": "Developer", "emailAddress": "Email Address", "encodedJwt": "Encoded JWT", "endorser": "Endorser", "errorGettingUrl": "Error fetching {url}", "genericError": "An error occurred", - "hideDeleted": "Hide Deleted", + "hideSuspended": "Hide Suspended", "invitationUrl": "Invitation URL", "json": "JSON", "loading": "Loading data. Please wait...", @@ -78,12 +76,14 @@ "refreshTable": "Refresh Table", "request": "Request", "searchByCreated": "Search By Created at Date", - "searchByDeleted": "Search By Deleted at Date", "searchByName": "Search By Name", + "searchBySuspended": "Search By Suspended at Date", "settings": "Settings", - "showDeleted": "Show Deleted", + "showSuspended": "Show Suspended", "status": "Status", "submit": "Submit", + "suspended": "Suspended", + "suspendedAt": "Suspended At", "tenantId": "Tenant ID", "tenantName": "Tenant Name", "tenantReason": "Tenant Reason", @@ -524,20 +524,20 @@ "confirmDeletion": "To confirm, type \"{tenantName}\" in the box below", "confirmDeletionIncorrect": "Incorrect tenant name. Please confirm the correct name before deletion.", "confirmDeletionSuccess": "Tenant {0} successfully marked as {1}", - "suspended": "suspended", "deleted": "deleted", "deleteTenant": "Suspend Tenant", - "permanentDelete": "Permanently Delete", - "softDelete": "Suspend Tenant", - "tenantDeletionWarning": ": This will delete all data associated with this tenant.", "editSettings": "Edit Tenant Config", "enableLedgerSwitch": "Tenant can switch endorser/ledger", "endorserAlias": "Endorser Alias:", "ledgerName": "Ledger Name:", + "permanentDelete": "Permanently Delete", "restoreConfirm": "Restore tenant {0}", "restoreSuccess": "Tenant {0} successfully restored", "restoreTenant": "Restore Tenant", - "success": "Tenant Config Updated" + "softDelete": "Suspend Tenant", + "success": "Tenant Config Updated", + "suspended": "suspended", + "tenantDeletionWarning": ": This will delete all data associated with this tenant." }, "tenants": "Tenants" }, diff --git a/services/tenant-ui/frontend/src/plugins/i18n/locales/fr.json b/services/tenant-ui/frontend/src/plugins/i18n/locales/fr.json index dd5f66361..0104f002c 100644 --- a/services/tenant-ui/frontend/src/plugins/i18n/locales/fr.json +++ b/services/tenant-ui/frontend/src/plugins/i18n/locales/fr.json @@ -67,6 +67,7 @@ "errorGettingUrl": "Error fetching {url} ", "genericError": "An error occurred ", "hideDeleted": "Hide Deleted ", + "hideSuspended": "Hide Suspended ", "invitationUrl": "Invitation URL ", "json": "JSON ", "loading": "Loading data. Please wait... ", @@ -80,15 +81,20 @@ "searchByCreated": "Search By Created at Date ", "searchByDeleted": "Search By Deleted at Date ", "searchByName": "Search By Name ", + "searchBySuspended": "Search By Suspended at Date ", "settings": "Settings ", "showDeleted": "Show Deleted ", + "showSuspended": "Show Suspended ", "status": "Status ", "submit": "Submit ", + "suspended": "Suspended ", + "suspendedAt": "Suspended At ", "tenantId": "Tenant ID ", "tenantName": "Tenant Name ", "tenantReason": "Tenant Reason ", "toggleCardExpand": "Toggle Expanded ", - "walletId": "Wallet ID " + "walletId": "Wallet ID ", + "warning": "Warning " }, "configuration": { "configuration": "Configuration ", @@ -322,13 +328,17 @@ "connectToEndorserAndRegisterDID": "Connect to Endorser and Register DID corresponding to a Ledger ", "contact": "Contact Email ", "createdAt": "Created at ", + "didNotActiveApproved": "DID Registration approved by Endorser, continue above. ", + "didNotActiveYet": "DID Registration approval pending, refresh or come back once Endorser approves request. ", "endorserConnection": "Endorser Connection ", "endorserInfo": "Endorser Info ", "imageUrl": "Image URL ", "issuer": "Issuer ", "name": "Name ", "noEndorserInfoFound": "No Endorser info found, issuance disabled ", + "pendingDidTx": "Pending Public DID Endorser Transaction ", "publicDid": "Public DID ", + "publicDidPending": "Requested Public DID (Pending Endorser Approval) ", "registerPublicDid": "Register a public DID ", "registerPublicDidNotAllowed": "Innkeeper has not approved public DID registration for your tenant ", "state": "State: {0} ", @@ -348,6 +358,7 @@ "tenantNotConnectedToEndorserYet": "Tenant not connected to Endorser yet ", "token": "JWT Token ", "updatedAt": "Updated at ", + "walletDids": "Wallet DIDs ", "walletLabel": "Wallet Label ", "webHookKey": "WebHook Key ", "webhooks": "Webhooks ", @@ -521,17 +532,22 @@ "canConnectEndorser": "Tenant allowed to connect to Endorser ", "canRegisterDid": "Tenant allowed to register public DID ", "confirmDeletion": "To confirm, type \"{tenantName}\" in the box below ", + "confirmDeletionIncorrect": "Incorrect tenant name. Please confirm the correct name before deletion. ", "confirmDeletionSuccess": "Tenant {0} successfully marked as deleted ", + "deleted": "deleted ", "deleteTenant": "Delete Tenant ", "editSettings": "Edit Tenant Config ", "enableLedgerSwitch": "Tenant can switch endorser/ledger ", "endorserAlias": "Endorser Alias ", "ledgerName": "Ledger Name ", + "permanentDelete": "Permanently Delete ", "restoreConfirm": "Restore tenant {0} ", "restoreSuccess": "Tenant {0} successfully restored ", "restoreTenant": "Restore Tenant ", + "softDelete": "Suspend Tenant ", "success": "Tenant Config Updated ", - "confirmDeletionIncorrect": "Incorrect tenant name. Please confirm the correct name before deletion. " + "suspended": "suspended ", + "tenantDeletionWarning": ": This will delete all data associated with this tenant. " }, "tenants": "Tenants " }, diff --git a/services/tenant-ui/frontend/src/plugins/i18n/locales/ja.json b/services/tenant-ui/frontend/src/plugins/i18n/locales/ja.json index 853ee6258..591893f0f 100644 --- a/services/tenant-ui/frontend/src/plugins/i18n/locales/ja.json +++ b/services/tenant-ui/frontend/src/plugins/i18n/locales/ja.json @@ -67,6 +67,7 @@ "errorGettingUrl": "Error fetching {url} ", "genericError": "An error occurred ", "hideDeleted": "Hide Deleted ", + "hideSuspended": "Hide Suspended ", "invitationUrl": "Invitation URL ", "json": "JSON ", "loading": "Loading data. Please wait... ", @@ -80,15 +81,20 @@ "searchByCreated": "Search By Created at Date ", "searchByDeleted": "Search By Deleted at Date ", "searchByName": "Search By Name ", + "searchBySuspended": "Search By Suspended at Date ", "settings": "Settings ", "showDeleted": "Show Deleted ", + "showSuspended": "Show Suspended ", "status": "Status ", "submit": "Submit ", + "suspended": "Suspended ", + "suspendedAt": "Suspended At ", "tenantId": "Tenant ID ", "tenantName": "Tenant Name ", "tenantReason": "Tenant Reason ", "toggleCardExpand": "Toggle Expanded ", - "walletId": "Wallet ID " + "walletId": "Wallet ID ", + "warning": "Warning " }, "configuration": { "configuration": "Configuration ", @@ -322,13 +328,17 @@ "connectToEndorserAndRegisterDID": "Connect to Endorser and Register DID corresponding to a Ledger ", "contact": "Contact Email ", "createdAt": "Created at ", + "didNotActiveApproved": "DID Registration approved by Endorser, continue above. ", + "didNotActiveYet": "DID Registration approval pending, refresh or come back once Endorser approves request. ", "endorserConnection": "Endorser Connection ", "endorserInfo": "Endorser Info ", "imageUrl": "Image URL ", "issuer": "Issuer ", "name": "Name ", "noEndorserInfoFound": "No Endorser info found, issuance disabled ", + "pendingDidTx": "Pending Public DID Endorser Transaction ", "publicDid": "Public DID ", + "publicDidPending": "Requested Public DID (Pending Endorser Approval) ", "registerPublicDid": "Register a public DID ", "registerPublicDidNotAllowed": "Innkeeper has not approved public DID registration for your tenant ", "state": "State: {0} ", @@ -348,6 +358,7 @@ "tenantNotConnectedToEndorserYet": "Tenant not connected to Endorser yet ", "token": "JWT Token ", "updatedAt": "Updated at ", + "walletDids": "Wallet DIDs ", "walletLabel": "Wallet Label ", "webHookKey": "WebHook Key ", "webhooks": "Webhooks ", @@ -521,17 +532,22 @@ "canConnectEndorser": "Tenant allowed to connect to Endorser ", "canRegisterDid": "Tenant allowed to register public DID ", "confirmDeletion": "To confirm, type \"{tenantName}\" in the box below ", + "confirmDeletionIncorrect": "Incorrect tenant name. Please confirm the correct name before deletion. ", "confirmDeletionSuccess": "Tenant {0} successfully marked as deleted ", + "deleted": "deleted ", "deleteTenant": "Delete Tenant ", "editSettings": "Edit Tenant Config ", "enableLedgerSwitch": "Tenant can switch endorser/ledger ", "endorserAlias": "Endorser Alias ", "ledgerName": "Ledger Name ", + "permanentDelete": "Permanently Delete ", "restoreConfirm": "Restore tenant {0} ", "restoreSuccess": "Tenant {0} successfully restored ", "restoreTenant": "Restore Tenant ", + "softDelete": "Suspend Tenant ", "success": "Tenant Config Updated ", - "confirmDeletionIncorrect": "Incorrect tenant name. Please confirm the correct name before deletion. " + "suspended": "suspended ", + "tenantDeletionWarning": ": This will delete all data associated with this tenant. " }, "tenants": "Tenants " },