Commencing with Neo4j 3.1 and implementaion of native database users it is possible to suspend a user, thus preventing the user from further authenticating in.
To view all suspended users run the following Cypher
Further if you encounter the need to suspend all users, for example to prevent all database access during a weekend maintenance period, the following Cypher can be used to generate Cypher statements which can then be used to suspend and subsequently reactivate all users.
- Build the Cypher statements to activate all currently ‘active’ users
- Build the Cypher statements to suspend all currently ‘active’ users
Finally at the time of the maintenance window one would first run the generated Cypher statements from above to suspend all users. Note it is not possible to suspend the user you are currently logged in as and as such you may see a call dbms.security.suspendUser result in failure error message of ‘Suspending yourself (user ‘neo4j’) is not allowed.’
At the completion of the maintenance window, one would then run the generated Cypher statement to activate all the currrently defined suspended users.