Extend user model to use groups and permissions

Fix for #223