API updates and some frontend testing

The testing is incomplete, but the few API changes are essential for the admin site.
Why did we change all the `$scope`s? Was it a bug or is it a reflection of a change in another part of the code?