Skip to content

Commit 2dc9f8e

Browse files
committed
fix(formanswer): default search filter hides legit access
1 parent 434bd35 commit 2dc9f8e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

hook.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,17 @@ function plugin_formcreator_addDefaultWhere($itemtype) {
202202
if (Session::haveRight('config', UPDATE)) {
203203
return '';
204204
}
205-
if (!PluginFormcreatorCommon::canValidate()) {
206-
return "`$table`.`requester_id` = $currentUser";
207-
}
205+
206+
// Check the user is a requester
207+
$condition = "`$table`.`requester_id` = $currentUser";
208208

209209
if (Plugin::isPluginActive(PLUGIN_FORMCREATOR_ADVANCED_VALIDATION)) {
210210
return PluginAdvformCommon::addDefaultWhere($itemtype);
211211
} else {
212-
// check the user
213-
$condition = " (`$table`.`users_id_validator` = $currentUser";
212+
// Check the user is a validator of the form answer
213+
$condition .= " OR (`$table`.`users_id_validator` = $currentUser";
214214

215-
// check groups of the user
215+
// check user is a member of validator groups of the form answer
216216
$groups = Group_User::getUserGroups($currentUser);
217217
if (count($groups) < 1) {
218218
// The user is not a member of any group

0 commit comments

Comments
 (0)