working user layers

Apart from a couple of fixes in here (like 319f672 and 69fb2ce) the majority of this was to make user-layers work.
You can confirm that by setting a key with sudo in the user layer results in the creation of `/tmp/user-0.db` and as a normal user you'll end up with something like `/tmp/user-1000.db`

Also with the minor change in 69fb2ce retrieving a key without using a layer name now works, as priorities now work correctly. With that working I believe @sofar will have an easier time deciding on how to work with these now :)

Having checked the mechanism myself, I can say I think perhaps its a little off? Right now we return the highest priority, in my case `user` returns when set, over `base`. I assume this is where we'd add a little smack magic to determine which one to actually return in combination with priority :)

This change, like I said, is mainly fixes, as I'm working separately on a relatively smallish demo incorporating a main loop so that we can test multiple client connections and client notifications. Need these changes in first though so I can adapt my stuff :)