Detect duplicate keys form user configuration

Apparently there are some duplicates in the phabricator
configuration, even though the interface has a check against
this.
This commit is contained in:
2020-11-05 12:50:00 +01:00
parent 1df20d771c
commit 284204e6bb

View File

@@ -51,7 +51,7 @@ class Configuration {
protected $config_file;
// Indexed by key content, contains configuration user name.
protected $system_keys;
protected $stored_keys;
// Indexed by config user name.
protected $used_keys;
@@ -80,8 +80,8 @@ class Configuration {
public function storeUserPublicKey($user, $key) {
$full_key_content = $this->getPublicKeyContent($key);
if (array_key_exists($full_key_content, $this->system_keys)) {
return $this->system_keys[$full_key_content];
if (array_key_exists($full_key_content, $this->stored_keys)) {
return $this->stored_keys[$full_key_content];
}
$config_user_name = $this->getConfigUserName($user, $key);
@@ -92,6 +92,8 @@ class Configuration {
$full_key_content);
}
$this->stored_keys[$full_key_content] = $config_user_name;
return $config_user_name;
}
@@ -180,7 +182,7 @@ class Configuration {
}
$key = file_get_contents("$this->keys_directory/$file");
$file_we = basename($file, '.pub');
$this->system_keys[$key] = $file_we;
$this->stored_keys[$key] = $file_we;
$this->used_keys[$file_we] = true;
}
}