SQL implementation of permission repository