Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for template preview on question creation #68

Open
Kemmotar83 opened this issue Nov 8, 2021 · 1 comment
Open

Error for template preview on question creation #68

Kemmotar83 opened this issue Nov 8, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@Kemmotar83
Copy link

Hi,

we experienced the following problem.

When a teacher tries to create a new Shortmath question, a permission error occurs. You can see it in the screenshot below (in a popup window).
image

In the question creation page, the page loads the Default template and correctly tries to preview it through a web service call to external function qtype_shortmath_get_template, which calls the get_template function inside the editor_template.
Inside this function template_require_capability_on is called, where the viewall capability is checked (template_has_capability_on) but, since Default template is assigned to system context and course teachers has no system capabilities, obviously a permission error occurs.

A workaround is to assign viewall capability to the Authenticated user role, since it is not assigned by default.
Maybe for "preview only" purpose users should not need any capability, which should be requested only inside template editor.

Steps to reproduce the behavior (after plugin installation):

  1. Create a "test user"
  2. Create a "test course"
  3. Enrol the "test user" in the "test course" with role "editing teacher"
  4. Log in as "test user"
  5. Go to "test course"
  6. Go to Question bank
  7. Create a new Shortmath question
  8. See the error as described before

Thanks,
Giorgio

@Kemmotar83 Kemmotar83 added the bug Something isn't working label Nov 8, 2021
@nadavkav
Copy link

nadavkav commented Jan 2, 2022

We started to experience the same issue, I wonder how come we never experience it before.
Thank you @Kemmotar83 for the workaround, which solved this issue, for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants