I have a wierd problem with capabilities. I'm developing an activity module. It's view is different for student and teacher. So I'm dealing with view.php file right now.
I added capabilities into the access.php file and everything works with admin account but not if I create some new user and enroll it into the course as a teacher. Everything looks OK inside a course, he can edit and manage the course but as soon as he gets into the activity context his privileges are not teacher anymore. It looks like he's a student. I thought capabilities are inherited from the parent context so in this case course.
Than I was thinking: if I call the has_capabilitiy function with a course context it will work...
so instead of:
i call this:
has_capability('mod/myplugin:tview', get_context_instance(CONTEXT_COURSE, $course->id)))
But I just don't get it - It still does not work!!