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

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

Open
ragesoss opened this issue Sep 3, 2024 · 5 comments

Comments

@ragesoss
Copy link
Member

ragesoss commented Sep 3, 2024

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
Copy link

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

@TunrayoIlawole
Copy link

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
Copy link

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

@Formasitchijoh
Copy link
Contributor

Formasitchijoh commented Oct 3, 2024

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
Copy link

Thank you @Formasitchijoh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants