How to restrict teacher only content from students

If you have a specific technical inquiry, construct your post with the following:

Summary

I need to find a way to restrict some content to teachers only on our server. I have a significant amount of content on our server for general learners, but some of it is meant to be for teachers only (quizzes/answers, processes/procedures, etc.). I need to find a way to make sure that content of that is not accessible to students. I’m willing to have the teachers log in with a specific ID so that content directed to them won’t show up for students, or I can place a password on that content and make sure that all teachers have the password. I’m open to any ideas. I have not been able to find a way to do that by reading the Kolibri documentation.

Thanks! Mark K

Technical details

  • Kolibri version: 0.15.9
  • Operating system: Ubuntu 18.04
  • Browser: Chrome, Edge, Firefox

Hi @markknit,

If you have curated these resources yourself on Studio, then it is possible to flag them as ‘coach only’ in the Studio interface - however, there is no way to toggle that flag on the offline Kolibri platform itself at the moment.

For Studio, the documentation here gives some guidance: Manage channel resources — Kolibri Studio User Guide

We will be working in the coming year to try to bring more of the editing capabilities such as this to the offline platform, so we will keep the community posted as more of these things become possible!

Kind Regards,
Richard

Thanks. I definitely meant for the offline version (in remote areas of Kenya). My concern is that any student that clicks on the ‘Channels’ button will see the teacher content there and jump on it.

Does anyone else have any ideas as a workaround?

Hi @markknit,

If you are comfortable using the command line and doing a little bit of scripting in Python, this is possible to do.

It sounds like you would like to hide entire channels from students? If so, for each channel with a specific channel id (visible in the Learn URL when first clicking on the channel), you could do something like this:

First go into the kolibri shell by typing kolibri shell in the command line.

Then enter the following Python code:

from kolibri.core.content.models import ContentNode
from kolibri.core.content.utils.annotation import recurse_annotation_up_tree

channel_id = "<channel_id>"

ContentNode.objects.filter(channel_id=channel_id).update(coach_content=True)

recurse_annotation_up_tree(channel_id)

For each channel you want to modify, you should replace <channel_id> with the 32 digit hexadecimal channel id (not the channel token that you might have used for import).

If you need to be more selective about which items you set as coach content, then further refinement to this would be needed.

Kind Regards,
Richard

This is helpful.

Please, could you revise the code to support multiple channel_id’s?

Better still, is there now an easier way to make this happen?

Thanks

PS: Will this work?

from kolibri.core.content.models import ContentNode
from kolibri.core.content.utils.annotation import recurse_annotation_up_tree

channel_ids = ["<channel_id1>", "<channel_id2>", "<channel_id3>"]  # List of channel IDs

for channel_id in channel_ids:
    ContentNode.objects.filter(channel_id=channel_id).update(coach_content=True)
    recurse_annotation_up_tree(channel_id)

Hi @nativebreed,

Yes that code looks like it should work just fine.

Just be aware that this may be overwritten if the channel is updated. If you would like to persist the setting, these directions will accomplish that!

Regards,
Blaine

Thank you Blaine.