[ticket/340] Correctly check if permission_setting template row exists

B3P-340
Merge pull request #345 from marc1706/ticket/340

[ticket/340] Correctly check if permission_setting template row exists