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

Downloading a course that is "public"/"allows guests" but in which I'm not enrolled #71

Closed
1 task done
YassineElbouchaibi opened this issue Jan 11, 2021 · 6 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@YassineElbouchaibi
Copy link

Avoid duplicates

  • Bug is not already reported in another issue

Describe the bug

In my config I have :

"download_course_ids": [
        326
 ]

I added that course id manually. Moodle Downloader won't sync this course as I'm not enrolled in it even if the course is available publicly and anyone can download the files. I got the id via the web app :
image

Is this intended behaviour ? I have not looked at the code yet but could this be easily worked around ?

Note: I went through all the logs generated and even the responses and the course id never comes up.

Steps to reproduce the issue

Try to download a course that is public but in which you are not enrolled.

Technical details

Expected behavior

If there is no permission error then the app should try to download the content from the requested course ids.

Possible Fix

Not familiar with the code and the flow but we could, but I'm guessing do not filter out courses that in which the student is not enrolled.

@YassineElbouchaibi YassineElbouchaibi added the bug Something isn't working label Jan 11, 2021
@C0D3D3V
Copy link
Owner

C0D3D3V commented Jan 11, 2021

This is somehow related to this very old request: #6

So this is actually desired behaviour so far. But it is actually useful to be able to choose courses in which you are not enrolled. But it would be more useful if we create an extra array in the configuration, because if you use the integrated configurator the courses you are not enrolled in would be removed from the list.

As I explained in the old issue, for a hotfix you could just add your courses directly at this point:
https://github.com/C0D3D3V/Moodle-Downloader-2/blob/c913368ca1efae4a4d8f8fdd217c42170059e774/moodle_dl/moodle_connector/moodle_service.py#L245

for e.g. like this (for the course course name with id 2342):

courses_list = first_contact_handler.fetch_courses(userid)
courses = []
courses.append(Course(2342, 'course name', []))

The shorter course name that you can specify in the configuration will be overwritten at this point:
https://github.com/C0D3D3V/Moodle-Downloader-2/blob/c913368ca1efae4a4d8f8fdd217c42170059e774/moodle_dl/moodle_connector/moodle_service.py#L304

Currently I have a lot to do for the university, so if you feel like it you can try to implement something useful and create a PullRequest. You are very welcome to do so :) Otherwise I will tackle this in a few days, should not be a big effort.

@YassineElbouchaibi
Copy link
Author

I think I can give it a go, do you have a discord so I can ask you some questions in a more direct manner ?

@C0D3D3V
Copy link
Owner

C0D3D3V commented Jan 11, 2021

c0d3d3v#8812 is my username in discord... if that does not work just send me a mail.

@YassineElbouchaibi
Copy link
Author

YassineElbouchaibi commented Jan 11, 2021

I wasn't able to get you on discord so I'll just ask here. Do you know an endpoint that returns info about a course like its display name given the courseId ?

Edit : Seems like core_course_get_courses_by_field does the job.

@YassineElbouchaibi
Copy link
Author

Made a PR. Feel free to clone my PR and tweak it as you wish for formatting and naming of variables.

C0D3D3V pushed a commit that referenced this issue Jan 12, 2021
@C0D3D3V
Copy link
Owner

C0D3D3V commented Jan 12, 2021

I have created a wiki entry for this option and linked it in the readme. Feel free to edit it.

Thank you so much for implementing this in such a great way.

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