Authorisation and auditing

Implemented authorisation against a domain. Wrote a code generator to
create audit triggers and added an auditing table. Fixed the Role table
so that the primary key is no longer an identity so that the seeding
works correctly. Also did some refactoring.