MODE-2167 Added the ability to turn off ACLs if all policies were removed

The implementation was done by using an counter property stored on the {{jcr:system}} node. This basically tracks the total number of nodes (from all workspaces) that have ACLs.
While implementing this, I also updated the {{jcr:system}} node definition to all any kind of properties (protected). This should give us greater flexibility in the future.

The code changes also contains an upgrade function to 4.0 which fixes existing repositories.