[Application] Added permission check and storage logic.

This patch contains two major parts:

Permission check: it's unfinished because some of it's logic need
to be put into the Application class which does not exist for the moment, the
corresponding code in ApplicationService is ready though. The remaining
tasks are marked by TODOs

Permission storage: permissions should be stored in ApplicationData and
eventually the database, so now we have setter and getter in the
ApplicationData class and the actual db operations are done inside
ApplicationStorageImpl. While, there are still some parts missing, like
the session storage which should also be implemented in the Application
calss.

With this patch and PR1231 together, the permission system still cannot
work because of lacking certain critical components in the Application
class.