[ARCHIVED] Permission to Control Course Visibility Idea Support

Jump to solution
dwillmore
Community Champion

Please support this idea: Add permission to control who has the ability to change the Visibility field.  We now have a pretty big problem that I need to get a handle on here.   With more than 1k courses improperly set to Public visibility and no API to change those settings, I have a challenge before me.

Labels (2)
1 Solution
James
Community Champion

 @dwillmore ‌,

Sometimes things are hard to find in the API, but this is definitely there.

The Update a course API endpoint lists the endpoint:

course[is_public], which is a boolean and the description is "Set to true if course is public to both authenticated and unauthenticated users."

The information that you need to send is minimal, just replace :course_id with the actual course id.

PUT /api/v1/courses/:course_id?course[is_public]=0

If you're not sure which courses you need to change, you can use the List all courses API endpoint to get that list.  Make this call to get 100 at a time.

GET /api/v1/search/all_courses?public_only=1&per_page=100

Anything beyond that will require pagination. The course ID that you need to send in the Update a course endpoint is shown here as the id.

Here's one of the them

219915_pastedImage_2.png

You can also use the Public Courses report that's found under Admin > Instance > Settings > Report. This might be a better way if you need to selectively privatize some courses. If you want to do it to every course or if all the courses have a common name like "Sandbox", then the search route will get the list and then you can iterate through it.

View solution in original post