WikiEducationFoundation / WikiEduDashboard

Wiki Education Foundation's Wikipedia course dashboard system
https://dashboard.wikiedu.org
MIT License
392 stars 630 forks source link

User#can_edit? may prevent editing by a user who has multiple roles in a course #5948

Closed ragesoss closed 3 weeks ago

ragesoss commented 2 months ago

What is happening?

The facilitator for this event, who is also participating as an editor, reports an permissions error when trying to edit the tracked wikis: https://outreachdashboard.wmflabs.org/courses/Wikimedians_of_Kerala/Wiki_Loves_Onam_2024/home

I think this is because of the implementation of User#role, which looks for a single CoursesUsers record, so if the wrong one is found the user will be treated as a 'student' rather than 'instructor'.

Additional context

A fix for this should include a unit test for #can_edit? that fails with the current implementation but passes with a fixed implementation.

TunrayoIlawole commented 1 month ago

Hi @ragesoss , please i would like to work on this

TunrayoIlawole commented 1 month ago

I am currently trying to set up my development environment @ragesoss. I will get started on the issue as soon as i get it running

TunrayoIlawole commented 1 month ago

Hi @ragesoss , please I am having trouble finding where the unit tests are. Can you help point me to the directory?

Formasitchijoh commented 1 month ago

Hi @TunrayoIlawole which unit test are you looking for? If you are looking for the test for the #can_edit, it is found in the user_spec.rb file in the spec folder,

TunrayoIlawole commented 1 month ago

Thank you @Formasitchijoh

crocmons commented 1 month ago

I would like to work on this! @ragesoss

ragesoss commented 1 month ago

@crocmons someone else is actively working on this already. I recommend choosing a different issue.