fix(security): Pods-Meta nur lesbar, wenn Pods aktiv, aber nicht nutzbar
Ist Pods aktiv, seine API aber nicht nutzbar, melden gesampelte und registrierte Meta-Schlüssel READONLY statt schreibbar. Sonst würden Pods-Felder (auch über Pods' register_meta-Integration) an Pods vorbei geschrieben. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8f3a4e76eb
commit
234fd1edac
@@ -15,7 +15,8 @@ final class SampledMetaSource extends MetaFieldSource
|
||||
private const SAMPLE_POSTS = 50;
|
||||
private const MAX_KEYS = 200;
|
||||
|
||||
public function __construct(private ?\wpdb $db = null)
|
||||
/** @param bool $readOnly Report the keys as READONLY (Pods is active but cannot be used to write them). */
|
||||
public function __construct(private ?\wpdb $db = null, private bool $readOnly = false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -48,7 +49,13 @@ final class SampledMetaSource extends MetaFieldSource
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields[] = new FieldDefinition($key, $key, 'unknown', 'sample', FieldDefinition::UNKNOWN);
|
||||
$fields[] = new FieldDefinition(
|
||||
$key,
|
||||
$key,
|
||||
'unknown',
|
||||
'sample',
|
||||
$this->readOnly ? FieldDefinition::READONLY : FieldDefinition::UNKNOWN
|
||||
);
|
||||
}
|
||||
|
||||
return $fields;
|
||||
|
||||
Reference in New Issue
Block a user