More tests and fixes

Fixed bug in permission creation.
Added cascade on changes/permissions for when sites are deleted.
Added delete tests to all resource handlers
Added create/update tests to permissions handler