app: add applications controller for handling API applications (internal API)
ui: js: controller: permission: fix autocompleting and selecting applications
ui: js: controller: permissions: slightly refactor for clarity, sanity and performance
#tmp - add debug log, fix tom typo(?)