"Freezing" a group (gitlab.com)

I’m an owner of a gitlab.com (premium) group, and I want to disable all users, which means to prevent them from pushing or making any other active action (before migration to the self-hosted solution as I don’t want to “loose” anything).
How can I do it?

One option could be to reduce the user permissions to the Guest/Minimal role. Permissions and roles | GitLab Note that users will run into errors on push — suggest communicating the freeze before putting it in place.

If you want to automate the task, the python-gitlab library provides access to group members and modifying their access level. Groups - python-gitlab v4.4.0 A tutorial for general library use cases is in Efficient DevSecOps workflows: Hands-on python-gitlab API automation