Bug #31773
closedTasks view fails for non-admin with PG::SyntaxError: ERROR: syntax error at or near "\'1,6,4,3,5\'"
Description
b'Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1921150 \n\n*Description of problem:*\nViewing the tasks page as non admin user with cloned manager role that has organizations assigned fails in ui with:\n\nCould not receive data: Request failed with status code 500\n\nprodlog (attached) shows:\n\n[I|app|f5671e24] Backtrace for \'Action failed\' error (ActionView::Template:: Error): PG::SyntaxError: ERROR: syntax error at or near "\'1,6,4,3,5\'"\n f5671e24 | LINE 9: ...foreman_tasks_locks_taxonomy5f5e24.resource_id IN \'1,6,4,3,5...\n f5671e24 | ^\n\n*Version-Release number of selected component (if applicable):*\n\nSatellite 6.8 snap 10\n\n*How reproducible:*\nalways\n\n*Steps to Reproduce:*\n1. Have a satellite with mutliple orgs\n2. Clone a manager role, assign it to all or some orgs\n3. Create a user, assign the role to it, assign it to one or more of the role\'s orgs\n4. Log in as the user or impersonate, navigate to Monitor > Tasks\n\n*Actual results:*\nNo tasks listed, above errors shown\n\n*Expected results:*\nTasks viewed as exoected\n\n*Additional info:*\nSeems to be related to org assignment in cloned role, using the default manager role or using a cloned role with no org assigned doesn\'t produce this issue'
Added by Adam Ruzicka about 4 years ago
Added by Adam Ruzicka about 4 years ago
Refs #31773 - Fix pg syntax errors when searching by taxonomy
Previous fix allowed searching using IN, but only if there was a single value.
The value was treated as a string of comma-delimited numbers instead of an array
of numbers.
Fixes #31773 - Fix pg syntax errors when searching by taxonomy
This has raised an Exception because of a wrong SQL grouping.
The Exception being: # ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR: syntax error at or near "'1'" # LINE 3: ...foreman_tasks_links_taxonomy7a7295.resource_id IN '1' OR for...