clean up a bunch of example code, to better match more recent best practices. add a user permission bitwise field to demonstrate more advanced model and controller features