Added a feature for logging user accesses.

Still far from perfect. Needs reviews and a front-end counterpart.

Hope this can be automatically merged -- if you think is valid.