Check if app is enabled for user

Fixes https://github.com/owncloud/core/issues/12188 for AppFramework apps

@karlitschek Needs a backport. Security relevant.

@icewind1991 @Raydiation Please review.