Feature/sql permission checks

Reimplements permission checks in Arel/SQL which in turn improves extensibility and performance. Adds various performance improvements on other layers.
Unused method argument - `ignored`. If it's necessary, use `_` or `_ignored` as an argument name to indicate that it won't be used. You can also write as `arel_statement(*)` if you want the method to accept any arguments but don't care about them.