Skip to content

Allow IP based embargo to act on an array of multiple address/ranges. #377

@DiegoPino

Description

@DiegoPino

What?

This is on me. I coded/hardcoded the IP address validation to be done against a single valued JSON Key instead of an array of possible IPs/Ranges that allow an embargo to be bypassed.

The offending (more like single acting) code is this

if (strlen($ip_embargo_key) > 0 && !empty($jsondata[$ip_embargo_key]) && is_string($jsondata[$ip_embargo_key])) {
        $current_ip =  $this->requestStack->getCurrentRequest()->getClientIp();
        if ($current_ip) {
          $ip_embargo = IpUtils::checkIp4($current_ip, trim($jsondata[$ip_embargo_key]));
          $noembargo = $noembargo && $ip_embargo;
        }
      }

And what I need to add is a different strategy (iterating over each entry and accumulating/binary OR/AND resolved embargo bypasses if the field contains multiple single strings.

@alliomeria what I mentioned today.

Metadata

Metadata

Assignees

Labels

EmbargoesHeart Shaped boxes

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions