engine: Selecting permissions based on app mode

Updated procedures getAllForEntity and getTreeForEntity to
list permissions based on application mode as well.

Earlier list of permissions applicable for all the application modes
were getting listed

Change-Id: I7d2d7f1c3d37ecfb66d0965bb0701f7ced6af84d
https://bugzilla.redhat.com/show_bug.cgi?id=1031899
Signed-off-by: ndarshan <dnarayan@redhat.com>