You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Glpi/Api/HL/Controller/SetupController.php
+49-3Lines changed: 49 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,8 @@ final class SetupController extends AbstractController
52
52
{
53
53
publicstaticfunctiongetRawKnownSchemas(): array
54
54
{
55
+
global$DB;
56
+
55
57
return [
56
58
'LDAPDirectory' => [
57
59
'x-version-introduced' => '2.0',
@@ -119,6 +121,29 @@ public static function getRawKnownSchemas(): array
119
121
'name' => ['type' => Doc\Schema::TYPE_STRING],
120
122
'value' => ['type' => Doc\Schema::TYPE_STRING],
121
123
],
124
+
'x-rights-conditions' => [
125
+
'read' => staticfunction () use ($DB) {
126
+
// Make a SQL request to get all config items so we can check which are undisclosed
127
+
// We are using safe IDs rather than undisclosed IDs to avoid issues with concurrent modifications
128
+
// We cannot reliably lock the table due to the fact that the DB connection here may differ from the one used to perform the actual read in the Search code
129
+
$disclosed_ids = [];
130
+
131
+
$it = $DB->request([
132
+
'SELECT' => ['id', 'context', 'name'],
133
+
'FROM' => 'glpi_configs',
134
+
]);
135
+
$test_configs = [];
136
+
foreach ($itas$row) {
137
+
$test_configs[] = $row + ['value' => 'dummy'];
138
+
}
139
+
foreach ($test_configsas$f) {
140
+
if (!self::isUndisclosedConfig($f['context'], $f['name'])) {
141
+
$disclosed_ids[] = $f['id'];
142
+
}
143
+
}
144
+
return ['WHERE' => ['_.id' => $disclosed_ids]];
145
+
}
146
+
]
122
147
],
123
148
];
124
149
}
@@ -230,7 +255,7 @@ public function deleteItem(Request $request): Response
0 commit comments