Site pages and collections : Site unavailable error after enabling lti plugin.

Bug #1839499 reported by Shalu Garg on 2019-08-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
High
Unassigned
18.10
High
Unassigned
19.04
High
Unassigned
19.10
High
Unassigned

Bug Description

Hi,

I use Mahara 18.10.1 on ubunto 16.04.3, php 7.0.8, apache2 and Postgres 10.6.

After enabling LTI plugin , and logging as a non-admin user , if we visit pages and collections page, it will through site unavailable error.

Steps to reproduce
* Visit the site.
* Make sure we have enabled the LTI Plugin.
* Login as a non-admin user.
* Go to the Pages and collections page(Main menu->Create->Pages and Collections)
* Site unavailable Error

More precisely,On switching on the debug mode We are getting this error because of an Sql Exception after swtiching on the lTI plugin.It says group by is required while selecting a.id (lti as a )when using aggregate function.

Here goes the git diff output:

diff --git a/htdocs/lib/view.php b/htdocs/lib/view.php
--- a/htdocs/lib/view.php
+++ b/htdocs/lib/view.php
@@ -4168,8 +4168,9 @@ class View {
             $collfrom .= $fromstr;

             if (!empty($groupby)) {
- $groupby .= ', g.id, h.wwwroot';
- $collgroupby .= ', g.id, h.wwwroot';
+ // CATALYST CUSTOM - adding groupby condition for lti_assessment id column.
+ $groupby .= ', g.id, h.wwwroot' . ($haslti ? ', a.id' : '');
+ $collgroupby .= ', g.id, h.wwwroot' . ($haslti ? ', a.id' : '');
             }
             $sort = '
                 ORDER BY ' . $order . ' vtitle, vid';

To correct this problem we need to add the LTI (a.id) in the group by condition(with a condition if LTI is enabled)

Reviewed: https://reviews.mahara.org/10252
Committed: https://git.mahara.org/mahara/mahara/commit/1d2bad4edf84c0c5b24c6196e2a7953f375a1a0f
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 1d2bad4edf84c0c5b24c6196e2a7953f375a1a0f
Author: Shalu Garg <email address hidden>
Date: Wed Aug 7 17:23:19 2019 +0100

Bug 1839499: Site pages and collections, Site unavailable error after enabling lti plugin

Fixing the issue of sql exception on pages & collections page after logging in as a non admin
user on enabling lti_assessment plugin. This is caused by calling a select statement for
lti_assessmentid column with aggregate function and group by condition,
but missing group by condition for lti_assessmentid.

Change-Id: I0a040018fadcf543452b24174964e929f286e552

Mahara Bot (dev-mahara) wrote :

Patch for "18.10_STABLE" branch: https://reviews.mahara.org/10257

Reviewed: https://reviews.mahara.org/10256
Committed: https://git.mahara.org/mahara/mahara/commit/fdc91b546d9252bae2025bb6c7662b995ed6aa8d
Submitter: Robert Lyon (<email address hidden>)
Branch: 19.04_STABLE

commit fdc91b546d9252bae2025bb6c7662b995ed6aa8d
Author: Shalu Garg <email address hidden>
Date: Wed Aug 7 17:23:19 2019 +0100

Bug 1839499: Site pages and collections, Site unavailable error after enabling lti plugin

Fixing the issue of sql exception on pages & collections page after logging in as a non admin
user on enabling lti_assessment plugin. This is caused by calling a select statement for
lti_assessmentid column with aggregate function and group by condition,
but missing group by condition for lti_assessmentid.

Change-Id: I0a040018fadcf543452b24174964e929f286e552
(cherry picked from commit 1d2bad4edf84c0c5b24c6196e2a7953f375a1a0f)

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/10257
Committed: https://git.mahara.org/mahara/mahara/commit/b2bac26efd561b9c79841bbb744036a05c214f3f
Submitter: Robert Lyon (<email address hidden>)
Branch: 18.10_STABLE

commit b2bac26efd561b9c79841bbb744036a05c214f3f
Author: Shalu Garg <email address hidden>
Date: Wed Aug 7 17:23:19 2019 +0100

Bug 1839499: Site pages and collections, Site unavailable error after enabling lti plugin

Fixing the issue of sql exception on pages & collections page after logging in as a non admin
user on enabling lti_assessment plugin. This is caused by calling a select statement for
lti_assessmentid column with aggregate function and group by condition,
but missing group by condition for lti_assessmentid.

Change-Id: I0a040018fadcf543452b24174964e929f286e552
(cherry picked from commit 1d2bad4edf84c0c5b24c6196e2a7953f375a1a0f)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers