Creating user: tests, cleanups.

First commit is the original small cleanup for the ```rbac_edit_save_or_add``` that was merged recently.
Then I was trying to write some tests -- those are in the last commit.
While writing the tests I needed to understand some code so I had to clean it up a bit. Those are commits 2-5.

Please, review, test, merge.