Closed versae closed 11 years ago
It's an or because the function checks if the user is a teacher of at least one course, not a teacher of every course.
Why don't you make a pull request with your function?
I see. I'd love to, but my code has some changes in models and because there is no migrations, I still have to merge your last changes manually. But I'll do when I had my core ready.
Thanks.
And I don't like we test for authentication in this function. It makes the function less reusable and sometimes I just want to check if a user is a teacher even if it is not the the currently active user.
+1
I'm implementing a new permission system. https://github.com/OpenMOOC/moocng/blob/improved-api/moocng/courses/permissions.py Hope to finish this work soon. The tastypie API and the main application will use it.
I like it! Have you considered the use of django-guardian? Maybe it can help.
This will be fixed when the new persmissions system is ready.
Taking a look on the code of
is_teacher
incourses/utils.py
, I think that I don't understand what it does. This line has anor
when maybe should be anand
:But, if this is the expected behaviour, there is a fast tweak that can improve the performance, since this function is invoked a lot of times across the code.