Started on permission backend structure.
Continued to permission backend.
Fixed tests.