diff --git a/backend/repository/asset.go b/backend/repository/asset.go index 80d0a22..8326296 100644 --- a/backend/repository/asset.go +++ b/backend/repository/asset.go @@ -57,7 +57,7 @@ func (r *Asset) GetAllByDomainAndContext( db = db. Joins("left join domains on domains.id = assets.domain_id"). Select(r.joinSelectString()). - Where("(assets.company_id = ? OR assets.company_id IS NULL) AND (domain_id = ? OR domain_id IS NULL)", companyID, domainID) + Where("(assets.company_id = ? OR assets.company_id IS NULL) AND domain_id = ?", companyID, domainID) } else { db.Where("assets.company_id = ?", companyID) } @@ -103,7 +103,7 @@ func (r *Asset) GetAllByGlobalContext( } var dbModels []*database.Asset dbRes := db. - Where("company_id IS NULL"). + Where("company_id IS NULL AND domain_id IS NULL"). Find(&dbModels) if dbRes.Error != nil { diff --git a/backend/testfiles/assets/attachment.txt b/backend/testfiles/assets/attachment-a.txt similarity index 100% rename from backend/testfiles/assets/attachment.txt rename to backend/testfiles/assets/attachment-a.txt diff --git a/backend/testfiles/assets/attachment-b.txt b/backend/testfiles/assets/attachment-b.txt new file mode 100644 index 0000000..9562308 --- /dev/null +++ b/backend/testfiles/assets/attachment-b.txt @@ -0,0 +1 @@ +Hi {{.FirstName}} Welcome to The Phishing Club! We are excited to have you here. Click here to get started. diff --git a/backend/testfiles/assets/contoso-logo.png b/backend/testfiles/assets/contoso-logo.png new file mode 100644 index 0000000..781fd40 Binary files /dev/null and b/backend/testfiles/assets/contoso-logo.png differ diff --git a/backend/testfiles/assets/domain.tld/contoso-logo.png b/backend/testfiles/assets/domain.tld/contoso-logo.png new file mode 100644 index 0000000..b48bde5 Binary files /dev/null and b/backend/testfiles/assets/domain.tld/contoso-logo.png differ diff --git a/backend/testfiles/assets/domain.tld/style.css b/backend/testfiles/assets/domain.tld/style.css index ba4e657..14600ec 100644 --- a/backend/testfiles/assets/domain.tld/style.css +++ b/backend/testfiles/assets/domain.tld/style.css @@ -1,3 +1,5 @@ +/** domain asset **/ * { background-color: red; + background: url(contoso-logo.png); } diff --git a/backend/testfiles/assets/style.css b/backend/testfiles/assets/style.css index 14042ca..2ea8343 100644 --- a/backend/testfiles/assets/style.css +++ b/backend/testfiles/assets/style.css @@ -1,3 +1,5 @@ +/** global asset **/ * { background-color: yellow; + background: url(contoso-logo.png); } diff --git a/frontend/src/routes/asset/+page.svelte b/frontend/src/routes/asset/+page.svelte index 5c5a1d4..295afca 100644 --- a/frontend/src/routes/asset/+page.svelte +++ b/frontend/src/routes/asset/+page.svelte @@ -36,7 +36,7 @@ const refresh = async () => { try { isTableLoading = true; - const res = await api.domain.getAll(tableURLParams, contextCompanyID); + const res = await api.domain.getAllSubset(tableURLParams, contextCompanyID); if (!res.success) { throw res.error; } diff --git a/frontend/src/routes/asset/[domain]/+page.svelte b/frontend/src/routes/asset/[domain]/+page.svelte index 4b37730..7bb1dc1 100644 --- a/frontend/src/routes/asset/[domain]/+page.svelte +++ b/frontend/src/routes/asset/[domain]/+page.svelte @@ -54,7 +54,8 @@ let isDeleteAlertVisible = false; let deleteValues = { id: null, - name: null + name: null, + path: null }; let modalMode = null; let modalText = ''; @@ -251,6 +252,7 @@ isDeleteAlertVisible = true; deleteValues.id = asset.id; deleteValues.name = asset.name; + deleteValues.path = asset.path; }; const onClickPreview = async (path) => { @@ -396,7 +398,7 @@ {#if isImageFile(asset.path)} {#await getImagePreviewUrl(asset.path)} -
+
{:then imageUrl} {#if imageUrl}