Overview
Setting an M-Files vault to read-only may come in handy with for example archive vaults that should no longer be modified, or as a temporary solution to prevent changes for example during vault development.
While there is an official improvement with ID 145780 for such a feature, this article offers some ideas for how to accomplish the same meanwhile.
Solution
There are multiple ways to go about this.
Read-only licenses
The simplest way would be to assign read-only licenses for every user. This works only if you have only one vault in the server, because the license affects all the vaults. So, it is not possible if the same user must be able to have read-only in one vault and then be able to edit in another vault in the same server.
Note that a read-only license will not prevent users from completing state transitions.
Read-only NACLs
The second option would be to change the Named Access Control Lists (NACLs) to read-only. Please note, however, that if users have manually changed permissions for objects, those will need to be searched for and separately handled.
Also, Read-only NACLs will not prevent the users from creating new objects or completing state transitions.
External users
Third option would be to mark all the users in the vault as "External user".
https://www.m-files.com/user-guide/latest/eng/New_user.html
This way basically they don't have access to anything (unless defined somewhere). Then you would simply modify the needed NACLs to include read permissions for external users. This doesn't differ much of the point 2, but can be useful if some users still need to have write permissions
Script
The fourth option is to use a script to prevent modifications to vault. This is a quick and dirty way of preventing changes.
Please note that scripting is not part of standard support, and this is just an example script to show how to use the API. Be aware that all scripts are run at your own risk.
A simple error in BeforeCheckOut event handler will prevent checking out existing objects. This also affects any attempt at modifying the metadata card. A similar script can be added to BeforeCreateNewObjectFinalize, which will throw error upon saving new object.
