I found the answer here and it works!
Preventing access to Private files
- To prevent all users having access to Private files, the administrator should disable the repository in Administration>Site administration>Plugins>Repositories>Manage repositories.and in Administration>Site administration>Users>Permissions>Define Roles edit the authenticated user role and set the capabilities 'moodle/user:manageownfiles' and 'repository/user:view' to prohibit.
- If only students are to be prevented from accessing private files (but teachers etc, allowed) then a new role should be made and assigned system wide. See FAQ 6 in Repositories FAQfor more information.