Add API access control
Fixing test errors
WIP