Added and fixed permission tests

- fixed test for db functions
- added tests for different users