zentyal 3.2 fix restrictions matching

This pull request also contains two patches from master that are fixing bugs