Greatly improved permission tab-complete. Fixes #1102