# GEMS Education - Part 4

# Groups

Teacher group form view

# Record Rules

Record rule for teachers

TIP

It is important to determine whether records that are not bound to any specific user should be visible to all users or not. Accordingly, the record rule domain should contain the falsy tuple i.e., ("teacher_id", "=", False).

# Sessions

This part of the case study allows us to explore the possibility of granting access to a model's records for portal users. Although teachers are internal users and can view the sessions using the model's views, in real-world applications we often want to limit ourselves to creating portal users who should still be able to access certain records.

Session list view

For this part, if the record rules and model access rights are implemented correctly, the following tests should pass:

  • Marc Demo (internal user) should be able to see the English session only.
  • Joel Willis (portal user) should be able to see the Mathematics (active) and Science (inactive) sessions.

WARNING

You must not implement any domain or additional logic in the controller or model or views to filter the sessions. Search methods in the ORM already return records based on the current user's access rights and record rules.

# Sessions of Marc Demo

Marc Demo's sessions

# Sessions of Joel Willis

TIP

To implement portal view templates, refer to the standard code for Invoices & Bills (opens new window).

Joel Willis's sessions in portal main view

TIP

If you are not able to see your custom portal entry/counter of sessions in the portal view, ensure that you have overridden the JavaScript widget PortalHomeCounters to include the counter, e.g. session_count.

Joel Willis's sessions in portal list view

WARNING

Active sessions must appear before the inactive ones in this list view.

Joel Willis's sessions in portal form view