Get rid of old trust-auth config
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<7a9c0c1a8292affc2ed9584fca098c64>>
|
* @generated SignedSource<<a65c1699d7cf70edf7084ad4f3eaf603>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -32,7 +32,6 @@ export type TrustCenterAccessGraphCreateMutation$data = {
|
|||||||
readonly email: string;
|
readonly email: string;
|
||||||
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly lastTokenExpiresAt: string | null | undefined;
|
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly pendingRequestCount: number;
|
readonly pendingRequestCount: number;
|
||||||
};
|
};
|
||||||
@@ -127,13 +126,6 @@ v3 = {
|
|||||||
"name": "createdAt",
|
"name": "createdAt",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "lastTokenExpiresAt",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -246,16 +238,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "b080e2a38e706bea45f06507675582a4",
|
"cacheID": "6afb34eabf677345a8b94479a62b101d",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterAccessGraphCreateMutation",
|
"name": "TrustCenterAccessGraphCreateMutation",
|
||||||
"operationKind": "mutation",
|
"operationKind": "mutation",
|
||||||
"text": "mutation TrustCenterAccessGraphCreateMutation(\n $input: CreateTrustCenterAccessInput!\n) {\n createTrustCenterAccess(input: $input) {\n trustCenterAccessEdge {\n cursor\n node {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n }\n }\n }\n}\n"
|
"text": "mutation TrustCenterAccessGraphCreateMutation(\n $input: CreateTrustCenterAccessInput!\n) {\n createTrustCenterAccess(input: $input) {\n trustCenterAccessEdge {\n cursor\n node {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n }\n }\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "c33af388ca0957f16ee36e06339d61d3";
|
(node as any).hash = "71ca86286860103cdce4720d26a52f21";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<103e4c33c37a708bdc24fe74767725b9>>
|
* @generated SignedSource<<0a06a583c9eafcd4b26a4ec7415ca88b>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -236,13 +236,6 @@ return {
|
|||||||
"name": "createdAt",
|
"name": "createdAt",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "lastTokenExpiresAt",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -326,16 +319,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "6b9515ca548d21d6ba53ac5d830010f5",
|
"cacheID": "650290081ecafbf348f371c1becf15e3",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterAccessGraphPaginationQuery",
|
"name": "TrustCenterAccessGraphPaginationQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query TrustCenterAccessGraphPaginationQuery(\n $count: Int\n $cursor: CursorKey\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...TrustCenterAccessGraph_accesses\n id\n }\n}\n\nfragment TrustCenterAccessGraph_accesses on TrustCenter {\n accesses(first: $count, after: $cursor, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n __typename\n }\n }\n }\n id\n}\n"
|
"text": "query TrustCenterAccessGraphPaginationQuery(\n $count: Int\n $cursor: CursorKey\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...TrustCenterAccessGraph_accesses\n id\n }\n}\n\nfragment TrustCenterAccessGraph_accesses on TrustCenter {\n accesses(first: $count, after: $cursor, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n __typename\n }\n }\n }\n id\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "41517deef6af7eec916f3a4bbfc217b7";
|
(node as any).hash = "7d69d885bc80ed04776bafa53157590e";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<4f1a16e8b28a887285c9bc578e201f75>>
|
* @generated SignedSource<<4daa20d8f82a95b0d405c37e5bac0280>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -251,13 +251,6 @@ return {
|
|||||||
"name": "createdAt",
|
"name": "createdAt",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "lastTokenExpiresAt",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -341,12 +334,12 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "a8ee8e139d510095436df64e84d7a5ba",
|
"cacheID": "605b209b5d31e97773f696a76b752bd5",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterAccessGraphQuery",
|
"name": "TrustCenterAccessGraphQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query TrustCenterAccessGraphQuery(\n $trustCenterId: ID!\n $count: Int!\n $cursor: CursorKey\n) {\n node(id: $trustCenterId) {\n __typename\n ... on TrustCenter {\n id\n ...TrustCenterAccessGraph_accesses\n }\n id\n }\n}\n\nfragment TrustCenterAccessGraph_accesses on TrustCenter {\n accesses(first: $count, after: $cursor, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n __typename\n }\n }\n }\n id\n}\n"
|
"text": "query TrustCenterAccessGraphQuery(\n $trustCenterId: ID!\n $count: Int!\n $cursor: CursorKey\n) {\n node(id: $trustCenterId) {\n __typename\n ... on TrustCenter {\n id\n ...TrustCenterAccessGraph_accesses\n }\n id\n }\n}\n\nfragment TrustCenterAccessGraph_accesses on TrustCenter {\n accesses(first: $count, after: $cursor, orderBy: {field: CREATED_AT, direction: DESC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n pendingRequestCount\n activeCount\n canUpdate: permission(action: \"core:trust-center-access:update\")\n canDelete: permission(action: \"core:trust-center-access:delete\")\n __typename\n }\n }\n }\n id\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<9f1d003a890186ec86cfd58e7eb3bf28>>
|
* @generated SignedSource<<d0efc00be7fc303cb2c45ae11fe587c7>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -34,7 +34,6 @@ export type TrustCenterAccessGraphUpdateMutation$data = {
|
|||||||
readonly email: string;
|
readonly email: string;
|
||||||
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly lastTokenExpiresAt: string | null | undefined;
|
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly pendingRequestCount: number;
|
readonly pendingRequestCount: number;
|
||||||
readonly updatedAt: string;
|
readonly updatedAt: string;
|
||||||
@@ -126,13 +125,6 @@ v1 = [
|
|||||||
"name": "updatedAt",
|
"name": "updatedAt",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "lastTokenExpiresAt",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -172,16 +164,16 @@ return {
|
|||||||
"selections": (v1/*: any*/)
|
"selections": (v1/*: any*/)
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "8b330240bc19bbebb3244a49dc0a6db0",
|
"cacheID": "1367c160aa881878e5eed860509e7610",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterAccessGraphUpdateMutation",
|
"name": "TrustCenterAccessGraphUpdateMutation",
|
||||||
"operationKind": "mutation",
|
"operationKind": "mutation",
|
||||||
"text": "mutation TrustCenterAccessGraphUpdateMutation(\n $input: UpdateTrustCenterAccessInput!\n) {\n updateTrustCenterAccess(input: $input) {\n trustCenterAccess {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n updatedAt\n lastTokenExpiresAt\n pendingRequestCount\n activeCount\n }\n }\n}\n"
|
"text": "mutation TrustCenterAccessGraphUpdateMutation(\n $input: UpdateTrustCenterAccessInput!\n) {\n updateTrustCenterAccess(input: $input) {\n trustCenterAccess {\n id\n email\n name\n active\n hasAcceptedNonDisclosureAgreement\n createdAt\n updatedAt\n pendingRequestCount\n activeCount\n }\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "f78b4d25b0977a14269491db951a1d9d";
|
(node as any).hash = "7e5d2ce261f3e877ef54e5acfbd00bde";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<6cbc57ab24be22cdb76257d73f3a47d5>>
|
* @generated SignedSource<<17aba6dd50ebba280c11c963a4adede3>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -24,7 +24,6 @@ export type TrustCenterAccessGraph_accesses$data = {
|
|||||||
readonly email: string;
|
readonly email: string;
|
||||||
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
readonly hasAcceptedNonDisclosureAgreement: boolean;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly lastTokenExpiresAt: string | null | undefined;
|
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly pendingRequestCount: number;
|
readonly pendingRequestCount: number;
|
||||||
};
|
};
|
||||||
@@ -214,13 +213,6 @@ return {
|
|||||||
"name": "createdAt",
|
"name": "createdAt",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "lastTokenExpiresAt",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -296,6 +288,6 @@ return {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "41517deef6af7eec916f3a4bbfc217b7";
|
(node as any).hash = "7d69d885bc80ed04776bafa53157590e";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ export const trustCenterAccessesPaginationFragment = graphql`
|
|||||||
active
|
active
|
||||||
hasAcceptedNonDisclosureAgreement
|
hasAcceptedNonDisclosureAgreement
|
||||||
createdAt
|
createdAt
|
||||||
lastTokenExpiresAt
|
|
||||||
pendingRequestCount
|
pendingRequestCount
|
||||||
activeCount
|
activeCount
|
||||||
canUpdate: permission(action: "core:trust-center-access:update")
|
canUpdate: permission(action: "core:trust-center-access:update")
|
||||||
@@ -71,7 +70,6 @@ export const createTrustCenterAccessMutation = graphql`
|
|||||||
active
|
active
|
||||||
hasAcceptedNonDisclosureAgreement
|
hasAcceptedNonDisclosureAgreement
|
||||||
createdAt
|
createdAt
|
||||||
lastTokenExpiresAt
|
|
||||||
pendingRequestCount
|
pendingRequestCount
|
||||||
activeCount
|
activeCount
|
||||||
canUpdate: permission(action: "core:trust-center-access:update")
|
canUpdate: permission(action: "core:trust-center-access:update")
|
||||||
@@ -95,7 +93,6 @@ export const updateTrustCenterAccessMutation = graphql`
|
|||||||
hasAcceptedNonDisclosureAgreement
|
hasAcceptedNonDisclosureAgreement
|
||||||
createdAt
|
createdAt
|
||||||
updatedAt
|
updatedAt
|
||||||
lastTokenExpiresAt
|
|
||||||
pendingRequestCount
|
pendingRequestCount
|
||||||
activeCount
|
activeCount
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,10 +48,6 @@ export function TrustCenterAccessItem(props: TrustCenterAccessItemProps) {
|
|||||||
[deleteInvitation, connectionId],
|
[deleteInvitation, connectionId],
|
||||||
);
|
);
|
||||||
|
|
||||||
const isExpired = access.lastTokenExpiresAt
|
|
||||||
? new Date(access.lastTokenExpiresAt) < new Date()
|
|
||||||
: false;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tr
|
<Tr
|
||||||
@@ -62,11 +58,6 @@ export function TrustCenterAccessItem(props: TrustCenterAccessItemProps) {
|
|||||||
<Td className="font-medium">{access.name}</Td>
|
<Td className="font-medium">{access.name}</Td>
|
||||||
<Td>{access.email}</Td>
|
<Td>{access.email}</Td>
|
||||||
<Td>{formatDate(access.createdAt)}</Td>
|
<Td>{formatDate(access.createdAt)}</Td>
|
||||||
<Td className={isExpired ? "text-txt-danger" : ""}>
|
|
||||||
{access.lastTokenExpiresAt
|
|
||||||
? formatDate(access.lastTokenExpiresAt)
|
|
||||||
: "-"}
|
|
||||||
</Td>
|
|
||||||
<Td>
|
<Td>
|
||||||
<div className="flex justify-center">
|
<div className="flex justify-center">
|
||||||
{access.active ? (
|
{access.active ? (
|
||||||
|
|||||||
@@ -169,7 +169,6 @@ export default function TrustCenterAccessTab() {
|
|||||||
<Th>{__("Name")}</Th>
|
<Th>{__("Name")}</Th>
|
||||||
<Th>{__("Email")}</Th>
|
<Th>{__("Email")}</Th>
|
||||||
<Th>{__("Date")}</Th>
|
<Th>{__("Date")}</Th>
|
||||||
<Th>{__("Expires")}</Th>
|
|
||||||
<Th className="text-center">{__("Active")}</Th>
|
<Th className="text-center">{__("Active")}</Th>
|
||||||
<Th className="text-center">{__("Access")}</Th>
|
<Th className="text-center">{__("Access")}</Th>
|
||||||
<Th className="text-center">{__("Requests")}</Th>
|
<Th className="text-center">{__("Requests")}</Th>
|
||||||
@@ -208,9 +207,7 @@ export default function TrustCenterAccessTab() {
|
|||||||
<DialogContent padded className="space-y-6">
|
<DialogContent padded className="space-y-6">
|
||||||
<div>
|
<div>
|
||||||
<p className="text-txt-secondary text-sm mb-4">
|
<p className="text-txt-secondary text-sm mb-4">
|
||||||
{__(
|
{__("Give a person access to your trust center")}
|
||||||
"Send a 30-day access token to an external person to view your trust center",
|
|
||||||
)}
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<Field
|
<Field
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import (
|
|||||||
"embed"
|
"embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
htmltemplate "html/template"
|
htmltemplate "html/template"
|
||||||
"math"
|
|
||||||
texttemplate "text/template"
|
texttemplate "text/template"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -156,21 +155,17 @@ func RenderFrameworkExport(baseURL, fullName, downloadUrl string) (subject strin
|
|||||||
return subjectFrameworkExport, textBody, htmlBody, err
|
return subjectFrameworkExport, textBody, htmlBody, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func RenderTrustCenterAccess(baseURL, fullName, organizationName, accessUrl string, tokenDuration time.Duration) (subject string, textBody string, htmlBody *string, err error) {
|
func RenderTrustCenterAccess(baseURL, fullName, organizationName, accessUrl string) (subject string, textBody string, htmlBody *string, err error) {
|
||||||
durationInDays := int(math.Round(tokenDuration.Hours() / 24))
|
|
||||||
|
|
||||||
data := struct {
|
data := struct {
|
||||||
FullName string
|
FullName string
|
||||||
OrganizationName string
|
OrganizationName string
|
||||||
AccessUrl string
|
AccessUrl string
|
||||||
LogoURL string
|
LogoURL string
|
||||||
DurationInDays int
|
|
||||||
}{
|
}{
|
||||||
FullName: fullName,
|
FullName: fullName,
|
||||||
OrganizationName: organizationName,
|
OrganizationName: organizationName,
|
||||||
AccessUrl: accessUrl,
|
AccessUrl: accessUrl,
|
||||||
LogoURL: baseURL + logoURLPath,
|
LogoURL: baseURL + logoURLPath,
|
||||||
DurationInDays: durationInDays,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
textBody, htmlBody, err = renderEmail(trustCenterAccessTextTemplate, trustCenterAccessHTMLTemplate, data)
|
textBody, htmlBody, err = renderEmail(trustCenterAccessTextTemplate, trustCenterAccessHTMLTemplate, data)
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ type (
|
|||||||
NDAFileID *gid.GID `db:"nda_file_id"`
|
NDAFileID *gid.GID `db:"nda_file_id"`
|
||||||
CreatedAt time.Time `db:"created_at"`
|
CreatedAt time.Time `db:"created_at"`
|
||||||
UpdatedAt time.Time `db:"updated_at"`
|
UpdatedAt time.Time `db:"updated_at"`
|
||||||
LastTokenExpiresAt *time.Time `db:"last_token_expires_at"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TrustCenterAccesses []*TrustCenterAccess
|
TrustCenterAccesses []*TrustCenterAccess
|
||||||
@@ -92,8 +91,7 @@ SELECT
|
|||||||
has_accepted_non_disclosure_agreement_metadata,
|
has_accepted_non_disclosure_agreement_metadata,
|
||||||
nda_file_id,
|
nda_file_id,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at,
|
updated_at
|
||||||
last_token_expires_at
|
|
||||||
FROM
|
FROM
|
||||||
trust_center_accesses
|
trust_center_accesses
|
||||||
WHERE
|
WHERE
|
||||||
@@ -146,8 +144,7 @@ SELECT
|
|||||||
has_accepted_non_disclosure_agreement_metadata,
|
has_accepted_non_disclosure_agreement_metadata,
|
||||||
nda_file_id,
|
nda_file_id,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at,
|
updated_at
|
||||||
last_token_expires_at
|
|
||||||
FROM
|
FROM
|
||||||
trust_center_accesses
|
trust_center_accesses
|
||||||
WHERE
|
WHERE
|
||||||
@@ -254,8 +251,7 @@ UPDATE trust_center_accesses SET
|
|||||||
updated_at = @updated_at,
|
updated_at = @updated_at,
|
||||||
has_accepted_non_disclosure_agreement = @has_accepted_non_disclosure_agreement,
|
has_accepted_non_disclosure_agreement = @has_accepted_non_disclosure_agreement,
|
||||||
has_accepted_non_disclosure_agreement_metadata = @has_accepted_non_disclosure_agreement_metadata,
|
has_accepted_non_disclosure_agreement_metadata = @has_accepted_non_disclosure_agreement_metadata,
|
||||||
nda_file_id = @nda_file_id,
|
nda_file_id = @nda_file_id
|
||||||
last_token_expires_at = @last_token_expires_at
|
|
||||||
WHERE
|
WHERE
|
||||||
%s
|
%s
|
||||||
AND id = @id
|
AND id = @id
|
||||||
@@ -270,8 +266,7 @@ WHERE
|
|||||||
"updated_at": tca.UpdatedAt,
|
"updated_at": tca.UpdatedAt,
|
||||||
"has_accepted_non_disclosure_agreement": tca.HasAcceptedNonDisclosureAgreement,
|
"has_accepted_non_disclosure_agreement": tca.HasAcceptedNonDisclosureAgreement,
|
||||||
"has_accepted_non_disclosure_agreement_metadata": tca.HasAcceptedNonDisclosureAgreementMetadata,
|
"has_accepted_non_disclosure_agreement_metadata": tca.HasAcceptedNonDisclosureAgreementMetadata,
|
||||||
"nda_file_id": tca.NDAFileID,
|
"nda_file_id": tca.NDAFileID,
|
||||||
"last_token_expires_at": tca.LastTokenExpiresAt,
|
|
||||||
}
|
}
|
||||||
maps.Copy(args, scope.SQLArguments())
|
maps.Copy(args, scope.SQLArguments())
|
||||||
|
|
||||||
@@ -330,8 +325,7 @@ SELECT
|
|||||||
has_accepted_non_disclosure_agreement_metadata,
|
has_accepted_non_disclosure_agreement_metadata,
|
||||||
nda_file_id,
|
nda_file_id,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at,
|
updated_at
|
||||||
last_token_expires_at
|
|
||||||
FROM
|
FROM
|
||||||
trust_center_accesses
|
trust_center_accesses
|
||||||
WHERE
|
WHERE
|
||||||
|
|||||||
@@ -48,12 +48,6 @@ type ExportService interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
TrustConfig struct {
|
|
||||||
TokenSecret string
|
|
||||||
TokenDuration time.Duration
|
|
||||||
TokenType string
|
|
||||||
}
|
|
||||||
|
|
||||||
Service struct {
|
Service struct {
|
||||||
pg *pg.Client
|
pg *pg.Client
|
||||||
s3 *s3.Client
|
s3 *s3.Client
|
||||||
@@ -61,7 +55,6 @@ type (
|
|||||||
encryptionKey cipher.EncryptionKey
|
encryptionKey cipher.EncryptionKey
|
||||||
baseURL string
|
baseURL string
|
||||||
tokenSecret string
|
tokenSecret string
|
||||||
trustConfig TrustConfig
|
|
||||||
agentConfig agents.Config
|
agentConfig agents.Config
|
||||||
html2pdfConverter *html2pdf.Converter
|
html2pdfConverter *html2pdf.Converter
|
||||||
acmeService *certmanager.ACMEService
|
acmeService *certmanager.ACMEService
|
||||||
@@ -78,7 +71,6 @@ type (
|
|||||||
scope coredata.Scoper
|
scope coredata.Scoper
|
||||||
baseURL string
|
baseURL string
|
||||||
tokenSecret string
|
tokenSecret string
|
||||||
trustConfig TrustConfig
|
|
||||||
agent *agents.Agent
|
agent *agents.Agent
|
||||||
fileManager *filemanager.Service
|
fileManager *filemanager.Service
|
||||||
Frameworks *FrameworkService
|
Frameworks *FrameworkService
|
||||||
@@ -129,7 +121,6 @@ func NewService(
|
|||||||
bucket string,
|
bucket string,
|
||||||
baseURL string,
|
baseURL string,
|
||||||
tokenSecret string,
|
tokenSecret string,
|
||||||
trustConfig TrustConfig,
|
|
||||||
agentConfig agents.Config,
|
agentConfig agents.Config,
|
||||||
html2pdfConverter *html2pdf.Converter,
|
html2pdfConverter *html2pdf.Converter,
|
||||||
acmeService *certmanager.ACMEService,
|
acmeService *certmanager.ACMEService,
|
||||||
@@ -151,7 +142,6 @@ func NewService(
|
|||||||
encryptionKey: encryptionKey,
|
encryptionKey: encryptionKey,
|
||||||
baseURL: baseURL,
|
baseURL: baseURL,
|
||||||
tokenSecret: tokenSecret,
|
tokenSecret: tokenSecret,
|
||||||
trustConfig: trustConfig,
|
|
||||||
agentConfig: agentConfig,
|
agentConfig: agentConfig,
|
||||||
html2pdfConverter: html2pdfConverter,
|
html2pdfConverter: html2pdfConverter,
|
||||||
acmeService: acmeService,
|
acmeService: acmeService,
|
||||||
@@ -172,7 +162,6 @@ func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService {
|
|||||||
baseURL: s.baseURL,
|
baseURL: s.baseURL,
|
||||||
scope: coredata.NewScope(tenantID),
|
scope: coredata.NewScope(tenantID),
|
||||||
tokenSecret: s.tokenSecret,
|
tokenSecret: s.tokenSecret,
|
||||||
trustConfig: s.trustConfig,
|
|
||||||
agent: agents.NewAgent(nil, s.agentConfig),
|
agent: agents.NewAgent(nil, s.agentConfig),
|
||||||
fileManager: s.fileManager,
|
fileManager: s.fileManager,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -443,8 +443,6 @@ func (s TrustCenterAccessService) sendAccessEmail(ctx context.Context, tx pg.Con
|
|||||||
}
|
}
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
expiresAt := now.Add(s.svc.trustConfig.TokenDuration)
|
|
||||||
access.LastTokenExpiresAt = &expiresAt
|
|
||||||
access.UpdatedAt = now
|
access.UpdatedAt = now
|
||||||
|
|
||||||
if err := access.Update(ctx, tx, s.svc.scope); err != nil {
|
if err := access.Update(ctx, tx, s.svc.scope); err != nil {
|
||||||
@@ -467,7 +465,6 @@ func (s TrustCenterAccessService) sendTrustCenterAccessEmail(
|
|||||||
name,
|
name,
|
||||||
companyName,
|
companyName,
|
||||||
accessURL,
|
accessURL,
|
||||||
s.svc.trustConfig.TokenDuration,
|
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot render trust center access email: %w", err)
|
return fmt.Errorf("cannot render trust center access email: %w", err)
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ type (
|
|||||||
Pg pgConfig `json:"pg"`
|
Pg pgConfig `json:"pg"`
|
||||||
Api apiConfig `json:"api"`
|
Api apiConfig `json:"api"`
|
||||||
Auth authConfig `json:"auth"`
|
Auth authConfig `json:"auth"`
|
||||||
TrustAuth trustAuthConfig `json:"trust-auth"`
|
|
||||||
TrustCenter trustCenterConfig `json:"trust-center"`
|
TrustCenter trustCenterConfig `json:"trust-center"`
|
||||||
AWS awsConfig `json:"aws"`
|
AWS awsConfig `json:"aws"`
|
||||||
Notifications notificationsConfig `json:"notifications"`
|
Notifications notificationsConfig `json:"notifications"`
|
||||||
@@ -133,16 +132,6 @@ func New() *Implm {
|
|||||||
DomainVerificationResolverAddr: "8.8.8.8:53",
|
DomainVerificationResolverAddr: "8.8.8.8:53",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
TrustAuth: trustAuthConfig{
|
|
||||||
CookieName: "TCT",
|
|
||||||
CookieDomain: "localhost",
|
|
||||||
CookieDuration: 24,
|
|
||||||
TokenDuration: 720,
|
|
||||||
ReportURLDuration: 15,
|
|
||||||
TokenSecret: "this-is-a-secure-secret-for-trust-token-signing-at-least-32-bytes",
|
|
||||||
Scope: "trust_center_readonly",
|
|
||||||
TokenType: "trust_center_access",
|
|
||||||
},
|
|
||||||
TrustCenter: trustCenterConfig{
|
TrustCenter: trustCenterConfig{
|
||||||
HTTPAddr: ":80",
|
HTTPAddr: ":80",
|
||||||
HTTPSAddr: ":443",
|
HTTPSAddr: ":443",
|
||||||
@@ -220,12 +209,6 @@ func (impl *Implm) Run(
|
|||||||
return fmt.Errorf("cannot get cookie secret bytes: %w", err)
|
return fmt.Errorf("cannot get cookie secret bytes: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = impl.cfg.TrustAuth.GetTokenSecretBytes()
|
|
||||||
if err != nil {
|
|
||||||
rootSpan.RecordError(err)
|
|
||||||
return fmt.Errorf("cannot get trust auth token secret bytes: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
awsConfig := awsconfig.NewConfig(
|
awsConfig := awsconfig.NewConfig(
|
||||||
l,
|
l,
|
||||||
httpclient.DefaultPooledClient(
|
httpclient.DefaultPooledClient(
|
||||||
@@ -274,12 +257,6 @@ func (impl *Implm) Run(
|
|||||||
ModelName: impl.cfg.OpenAI.ModelName,
|
ModelName: impl.cfg.OpenAI.ModelName,
|
||||||
}
|
}
|
||||||
|
|
||||||
trustConfig := probo.TrustConfig{
|
|
||||||
TokenSecret: impl.cfg.TrustAuth.TokenSecret,
|
|
||||||
TokenDuration: time.Duration(impl.cfg.TrustAuth.TokenDuration) * time.Hour,
|
|
||||||
TokenType: impl.cfg.TrustAuth.TokenType,
|
|
||||||
}
|
|
||||||
|
|
||||||
agent := agents.NewAgent(l.Named("agent"), agentConfig)
|
agent := agents.NewAgent(l.Named("agent"), agentConfig)
|
||||||
|
|
||||||
fileManagerService := filemanager.NewService(s3Client)
|
fileManagerService := filemanager.NewService(s3Client)
|
||||||
@@ -383,7 +360,6 @@ func (impl *Implm) Run(
|
|||||||
impl.cfg.AWS.Bucket,
|
impl.cfg.AWS.Bucket,
|
||||||
impl.cfg.BaseURL.String(),
|
impl.cfg.BaseURL.String(),
|
||||||
impl.cfg.Auth.Cookie.Secret,
|
impl.cfg.Auth.Cookie.Secret,
|
||||||
trustConfig,
|
|
||||||
agentConfig,
|
agentConfig,
|
||||||
html2pdfConverter,
|
html2pdfConverter,
|
||||||
acmeService,
|
acmeService,
|
||||||
@@ -402,17 +378,11 @@ func (impl *Implm) Run(
|
|||||||
impl.cfg.AWS.Bucket,
|
impl.cfg.AWS.Bucket,
|
||||||
impl.cfg.BaseURL.String(),
|
impl.cfg.BaseURL.String(),
|
||||||
impl.cfg.EncryptionKey,
|
impl.cfg.EncryptionKey,
|
||||||
impl.cfg.TrustAuth.TokenSecret,
|
|
||||||
impl.cfg.GetSlackSigningSecret(),
|
impl.cfg.GetSlackSigningSecret(),
|
||||||
iamService,
|
iamService,
|
||||||
html2pdfConverter,
|
html2pdfConverter,
|
||||||
fileManagerService,
|
fileManagerService,
|
||||||
l,
|
l,
|
||||||
trust.TrustConfig{
|
|
||||||
TokenSecret: impl.cfg.TrustAuth.TokenSecret,
|
|
||||||
TokenDuration: time.Duration(impl.cfg.TrustAuth.TokenDuration) * time.Hour,
|
|
||||||
TokenType: impl.cfg.TrustAuth.TokenType,
|
|
||||||
},
|
|
||||||
slackService,
|
slackService,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ func NewTrustCenterAccess(tca *coredata.TrustCenterAccess) *TrustCenterAccess {
|
|||||||
HasAcceptedNonDisclosureAgreement: tca.HasAcceptedNonDisclosureAgreement,
|
HasAcceptedNonDisclosureAgreement: tca.HasAcceptedNonDisclosureAgreement,
|
||||||
CreatedAt: tca.CreatedAt,
|
CreatedAt: tca.CreatedAt,
|
||||||
UpdatedAt: tca.UpdatedAt,
|
UpdatedAt: tca.UpdatedAt,
|
||||||
LastTokenExpiresAt: tca.LastTokenExpiresAt,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go-v2/service/s3"
|
"github.com/aws/aws-sdk-go-v2/service/s3"
|
||||||
"go.gearno.de/kit/log"
|
"go.gearno.de/kit/log"
|
||||||
@@ -35,12 +34,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
TrustConfig struct {
|
|
||||||
TokenSecret string
|
|
||||||
TokenDuration time.Duration
|
|
||||||
TokenType string
|
|
||||||
}
|
|
||||||
|
|
||||||
Service struct {
|
Service struct {
|
||||||
pg *pg.Client
|
pg *pg.Client
|
||||||
s3 *s3.Client
|
s3 *s3.Client
|
||||||
@@ -54,7 +47,6 @@ type (
|
|||||||
html2pdfConverter *html2pdf.Converter
|
html2pdfConverter *html2pdf.Converter
|
||||||
fileManager *filemanager.Service
|
fileManager *filemanager.Service
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
trustConfig TrustConfig
|
|
||||||
slack *slack.Service
|
slack *slack.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,13 +57,11 @@ type (
|
|||||||
scope coredata.Scoper
|
scope coredata.Scoper
|
||||||
proboSvc *probo.Service
|
proboSvc *probo.Service
|
||||||
encryptionKey cipher.EncryptionKey
|
encryptionKey cipher.EncryptionKey
|
||||||
tokenSecret string
|
|
||||||
baseURL string
|
baseURL string
|
||||||
iam *iam.Service
|
iam *iam.Service
|
||||||
html2pdfConverter *html2pdf.Converter
|
html2pdfConverter *html2pdf.Converter
|
||||||
fileManager *filemanager.Service
|
fileManager *filemanager.Service
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
trustConfig TrustConfig
|
|
||||||
TrustCenters *TrustCenterService
|
TrustCenters *TrustCenterService
|
||||||
Documents *DocumentService
|
Documents *DocumentService
|
||||||
Audits *AuditService
|
Audits *AuditService
|
||||||
@@ -92,13 +82,11 @@ func NewService(
|
|||||||
bucket string,
|
bucket string,
|
||||||
baseURL string,
|
baseURL string,
|
||||||
encryptionKey cipher.EncryptionKey,
|
encryptionKey cipher.EncryptionKey,
|
||||||
tokenSecret string,
|
|
||||||
slackSigningSecret string,
|
slackSigningSecret string,
|
||||||
iam *iam.Service,
|
iam *iam.Service,
|
||||||
html2pdfConverter *html2pdf.Converter,
|
html2pdfConverter *html2pdf.Converter,
|
||||||
fileManagerService *filemanager.Service,
|
fileManagerService *filemanager.Service,
|
||||||
logger *log.Logger,
|
logger *log.Logger,
|
||||||
trustConfig TrustConfig,
|
|
||||||
slack *slack.Service,
|
slack *slack.Service,
|
||||||
) *Service {
|
) *Service {
|
||||||
return &Service{
|
return &Service{
|
||||||
@@ -106,14 +94,12 @@ func NewService(
|
|||||||
s3: s3Client,
|
s3: s3Client,
|
||||||
bucket: bucket,
|
bucket: bucket,
|
||||||
encryptionKey: encryptionKey,
|
encryptionKey: encryptionKey,
|
||||||
tokenSecret: tokenSecret,
|
|
||||||
slackSigningSecret: slackSigningSecret,
|
slackSigningSecret: slackSigningSecret,
|
||||||
baseURL: baseURL,
|
baseURL: baseURL,
|
||||||
iam: iam,
|
iam: iam,
|
||||||
html2pdfConverter: html2pdfConverter,
|
html2pdfConverter: html2pdfConverter,
|
||||||
fileManager: fileManagerService,
|
fileManager: fileManagerService,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
trustConfig: trustConfig,
|
|
||||||
slack: slack,
|
slack: slack,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,13 +112,11 @@ func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService {
|
|||||||
scope: coredata.NewScope(tenantID),
|
scope: coredata.NewScope(tenantID),
|
||||||
proboSvc: s.proboSvc,
|
proboSvc: s.proboSvc,
|
||||||
encryptionKey: s.encryptionKey,
|
encryptionKey: s.encryptionKey,
|
||||||
tokenSecret: s.tokenSecret,
|
|
||||||
baseURL: s.baseURL,
|
baseURL: s.baseURL,
|
||||||
iam: s.iam,
|
iam: s.iam,
|
||||||
html2pdfConverter: s.html2pdfConverter,
|
html2pdfConverter: s.html2pdfConverter,
|
||||||
fileManager: s.fileManager,
|
fileManager: s.fileManager,
|
||||||
logger: s.logger,
|
logger: s.logger,
|
||||||
trustConfig: s.trustConfig,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tenantService.TrustCenters = &TrustCenterService{svc: tenantService}
|
tenantService.TrustCenters = &TrustCenterService{svc: tenantService}
|
||||||
|
|||||||
@@ -485,8 +485,6 @@ func (s *TrustCenterAccessService) sendAccessEmail(ctx context.Context, tx pg.Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
expiresAt := now.Add(s.svc.trustConfig.TokenDuration)
|
|
||||||
access.LastTokenExpiresAt = &expiresAt
|
|
||||||
access.UpdatedAt = now
|
access.UpdatedAt = now
|
||||||
|
|
||||||
if err := access.Update(ctx, tx, s.svc.scope); err != nil {
|
if err := access.Update(ctx, tx, s.svc.scope); err != nil {
|
||||||
@@ -509,7 +507,6 @@ func (s *TrustCenterAccessService) sendTrustCenterAccessEmail(
|
|||||||
name,
|
name,
|
||||||
companyName,
|
companyName,
|
||||||
accessURL,
|
accessURL,
|
||||||
s.svc.trustConfig.TokenDuration,
|
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot render trust center access email: %w", err)
|
return fmt.Errorf("cannot render trust center access email: %w", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user