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

Capability check for user before importing series #413

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

ferishili
Copy link
Contributor

This PR fixes #378

Description

Currently a Opencast Block user can import every series he want's into his Moodle course, if he knows the series id.
He then can add, view and delete events in that series in Opencast from Moodle.

Solution

In order to solve this, we rely on series mapping that already existed in Moodle Opencast plugins environement, instead of having to extract course ids from Series ACL which could be a laborious task!
The new checking mechanism works as follows:

  • We look in the seriesmapping table based on the series and instance id.
    • if linked courses to the series could be found, we check if the user has capability of importing series in any of those courses. Then we consider the user as eligible to perform this task.
    • If the series is new and has not already been linked/introduced to the series mapping, then we also allow it!
    • If none of the above conditions could be met, we don't allow the user to import that series!

NOTE

during the implemention of this feature, I found out that the access capability is only granted to users with Manager role!

To TEST

  • Patch this PR
  • Prepare 2 courses and make sure they have default series.
  • Have a user as teacher and assign this user to both courses with roles:
    • Course 1: Teacher, Manager
    • Course 2: Teacher only!
  • Login as that user "Teacher"
  • Go to course 1 and try to import the series from course 2.
  • validate that the import is not possible, because the user has no capability to do so!
  • If you want to check the success scenario, you would need to give the Teacher the role "Manager" in course 2, and try the above series importing again and validate that it is now possible only because the user has the capability to do so in other course!

@ferishili ferishili added the bug Something which isn't working label Jan 10, 2025
@ferishili ferishili requested a review from bluetom January 10, 2025 08:32
@ferishili ferishili self-assigned this Jan 10, 2025
@bluetom bluetom merged commit 0df4144 into Opencast-Moodle:main Jan 13, 2025
7 checks passed
@bluetom bluetom added the 4.5.3 label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something which isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Series privileges
2 participants