[T] = Teacher account, [S] = Student account
1. Create a new, empty course
2. Enrol two users: first in Teacher role, second in Student role
3. Add new instance of Database activity
- In General section set Name = PrivateFields
- In Entries section set Entries required before viewing = 1
4. [T] As Teacher edit Fields in this database activity
5. Create two fields of type: Short text
- Field name: Title, Private field: no
- Field name: Summary, Private field: yes
6. Go to Templates view and shortly see generated templates
7. Click on Database and Add new entry as Teacher
- for example: Teacher entry + Techer summary
8. [S] Open another browser or another private browser window
9. Login as Student from the course
10. Navigate to database instance, it should display no entries for Student
11. Add new entry as Student
- for example: Student entry + Student summary
12. Navigate to Database in List view as Student
13. Student SHOULD see two entries
14. Student SHOULD see in his own entry both Title and Summary as entered
- In Teacher's entry Student SHOULD see original Title
- In Teacher's entry Student SHOULD NOT see original Summary, but a message "Can not view private field"
15. Edit Student entry as Student
- Title field should be editable
- Summary should be editable
16. Do not cancel nor save the entry yet
17. [T] Switch to Teacher browser / account
18. Navigate to the course where Database activity is present
19. Click on Participants, then navigate to Permissions view
20. Select in Advanced role override a role Student (0)
21. In Filter field enter: mod/data
22. Set capability "Edit private fields for own records | mod/data:editownprivatefields" = Prohibit
23. Save override permission changes
24. [S] Switch to Student browser / account
25. Try to Save changes in Student entry as Student
- Near Summary the Student SHOULD see field notification: "Can not edit private field"
- Contents of Summary SHOULD be visible, but not editable anymore
26. Save entry changes as Student again, it should succeed now
27. [T] Switch to Teacher browser / account
28. Select in Advanced role override a role Student (1)
29. In Filter field enter: mod/data
30. Set capability "View private fields for own records | mod/data:viewownprivatefields" = Prohibit
31. Save override permission changes
32. [S] Switch to Student browser / account
33. Navigate to Student entry or Teacher entry
- For both entries Student SHOULD NOT see original Summary, but a message "Can not view private field"
34. Edit Student entry as Student
- Title field should be editable
- Summary SHOULD NOT be editable, instead there should be a message "Can not edit private field"
35. Cancel the entry edit
36. [T] Switch to Teacher browser / account
37. Select in Advanced role override a role Student (2)
38. In Filter field enter: mod/data
39. Set capability "Edit private fields for own records | mod/data:editownprivatefields" = Inherit (Allow)
40. Set capability "View private fields for own records | mod/data:viewownprivatefields" = Inherit (Allow)
41. Set capability "View private fields for all records | mod/data:viewprivatefields" = Allow
42. Save override permission changes
43. [S] Switch to Student browser / account
44. Navigate to Database in List view as Student
45. Student SHOULD see two entries
46. Student SHOULD see in his own entry both Title and Summary as entered
47. Student SHOULD see in Teacher's entry both Title and Summary as entered