mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-02-12 16:12:44 +00:00
fix missing allow deny list on campaign create
Signed-off-by: Ronni Skansing <rskansing@gmail.com>
This commit is contained in:
@@ -152,6 +152,7 @@ func (r *Campaign) Insert(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errs.Wrap(err)
|
return nil, errs.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if allowDeny, err := campaign.AllowDenyIDs.Get(); err == nil && len(allowDeny) > 0 {
|
if allowDeny, err := campaign.AllowDenyIDs.Get(); err == nil && len(allowDeny) > 0 {
|
||||||
err = r.AddAllowDenyLists(ctx, &id, allowDeny)
|
err = r.AddAllowDenyLists(ctx, &id, allowDeny)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -211,7 +212,6 @@ func (r *Campaign) AddAllowDenyLists(
|
|||||||
campaignID *uuid.UUID,
|
campaignID *uuid.UUID,
|
||||||
allowDenyIDs []*uuid.UUID,
|
allowDenyIDs []*uuid.UUID,
|
||||||
) error {
|
) error {
|
||||||
|
|
||||||
batch := []database.CampaignAllowDeny{}
|
batch := []database.CampaignAllowDeny{}
|
||||||
for _, id := range allowDenyIDs {
|
for _, id := range allowDenyIDs {
|
||||||
batch = append(batch, database.CampaignAllowDeny{
|
batch = append(batch, database.CampaignAllowDeny{
|
||||||
|
|||||||
@@ -164,11 +164,13 @@ func (c *Campaign) Create(
|
|||||||
c.Logger.Errorw("failed to create campaign", "error", err)
|
c.Logger.Errorw("failed to create campaign", "error", err)
|
||||||
return nil, errs.Wrap(err)
|
return nil, errs.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
createdCampaign, err := c.CampaignRepository.GetByID(
|
createdCampaign, err := c.CampaignRepository.GetByID(
|
||||||
ctx,
|
ctx,
|
||||||
id,
|
id,
|
||||||
&repository.CampaignOption{
|
&repository.CampaignOption{
|
||||||
WithRecipientGroups: true,
|
WithRecipientGroups: true,
|
||||||
|
WithAllowDeny: true,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user