The question
The Enrollment Manager is a staff role in the LMS with a small job. It adds learners and enrols them on courses. The question was how to make sure it can’t do more than that.
What made it hard
A learner is added when the screen sends a create-user request to the server. That request can carry three fields that set what the user is allowed to do. They are the user’s role, their access roles and their audiences. Hiding those fields on the screen does not protect anything. Someone can fake a request by hand and still send them.
What I chose
The role has four permissions. It can list users and create users. It can list enrolmentsLMS · The platformEnrolment and accessEvery request is checked against the learner’s enrolment, or the course the instructor is assigned to.See it in the LMS build and create enrolments. It can’t edit or delete anything. It can’t manage courses or access, or give anyone an admin role.
The server code that handles users checks each request. It looks for a separate permission for managing users’ access, which is not one of the four. Without it, a request that carries any of those three fields is refused. For a request without them, the server fills them in itself. It sets student-only access and the audience every user needs, called Anyone. Editing someone’s contact details keeps their role and access settings as they were. So an ordinary update can’t quietly change what a user may do.
How I know it works
The tests check that the role can add learners and enrol them. They check that faked fields asking for more power are refused. So are changes the role is not allowed to make. They also check that the database change that adds the role can be undone. The August report shows 14 focused tests with 76 checks, and the full set of tests passing. The role is still on my own computer, not yet saved into the project’s history. Failures in a check of the outside code it relies on blocked its release.