Lino has a subtle new feature: a DetailLayout can now have a
required_roles attribute. If this
is given, then it overrides the default value which until now was
always the required_roles of the actor.

This was needed because otherwise after above change (make
Courses hidden for teachers), MyCoursesGiven had no
detail action as well (for teacher). Also e.g. obj2href() calls
get_default_table() which, for a course, is customized because
the detail of a course can be different depending on what we call the
“course area”. E.g. in Lino Voga we have “courses”, “hikes” and
“travels”. They all are activities, but their detail layouts defer.

This new feature required a few internal changes. Don’t try to
understand the following snippets in detail (I just used them in order
to understand myself)

Problem: When a session with a user is given, then
get_detail_action(ses) returned None because the default table was
(and is) Courses, not Activities. But here we want Lino to understand
that we actually do allow to open the detail window because that
detail window has been inherited from Activities.

Aha. Course defines a custom get_detail_action() because the
detail_layout to use when displaying a course depends on the
course_area (given by the course’s line). And this is
Courses in our case. And yes I told Lino that teachers don’t have
permission to see Courses.

We don’t want teachers to see all courses, but we do want them to
see the detail of a course for which they are author or instructor.

The library actions (default_action, detail_action, submit_detail,
insert_action, delete_action and update_action) had their
defining_actor to None.

The defining_actor of an action is the actor on which it has been
instantiated for the first time. Subclasses of the defining actor can
use the same action instance. That differentiation is used by the
extjs renderer: for actions that cause some JS code to be rendered it
makes no sense to generate that code several times.

A side effect is that I probably discovered and fixed a bug: teachers
had no permission to edit their own settings.