Ported some parts of permissions module
Remaining: auto promote, commands