As I see the lay of the land - APPS can be enabled on the server and installed by individual channels, but there is no "middle ground" that allows Apps to be installed on the server and only installable by SOME channels (based on either channel or account restrictions). (maybe I'm missing something... if so, I'd be grateful for a pointer)
I started working on some hooks to make it possible, but ran into an issue looking at the APP synchronization code that causes me to think a solution needs to be more widely discussed. My work so far simply hides the ability for a user to install an app on on their channel by filtering what is/isn't allowed on the channel app install screen based on a field in the SERVICE_CLASS array. It is thought to later expand this to a variable in pconfig so that the CART system could be used to allow paid access to specific apps.
I know it needs to go further, but I'm having trouble getting around how to deal with the scenario of a user cloning their channel on another instance and installing/enabling an app on the 2nd instance and having the app synchronization automatically enabling it on the original instance - which - if I read the code correctly - is the likely behavior if the hub itself has the app enabled even if the individual channel doesn't click the "install" button on their channel settings.
Then there's a second issue with regard to hooks. As far as I can tell, there is no central "app enabled" setting on a per-channel basis that blocks an app's hooks and code from running if it's enabled hub wide even if the app isn't installed on a channel itself (I've run into the scenario of hooks triggering for channels where the app wasn't installed more a couple of times during development).
So far I've resorted to creating an "enable" (pconfig) setting for the app(s) I've created. Any hooked functions that are triggered from elsewhere in the system do a check against the pconfig variable to make sure the app is "enabled". The problem is this solution seems wasteful (every hooked function must run the check every time it's triggered). And, it doesn't lend itself to the possibility of a hub admin blocking/enabling an app on a per channel or per account basis (for example, from the SERVICE_CLASS settings or even being able to enforce some sort of subscription payment structure for apps) but still having it enabled server wide for use by other users unless the app is specifically coded to behave this way (i.e., the app itself checks SERVICE_CLASS or some setting set by the cart system or some other settable variable).
I admit, I may be entirely missing something obvious in the code - but I don't see the current code permitting these scenarios. At the same time, I see an implicit intention to support such things. Even if it is just me reading into the project my own thoughts and desires, it seems that these would certainly be features that would help immensely hub admins who want to more completely "hide" functionality from some users and open it up to more advanced users (or paying subscribers).
There is no "silver bullet" to fix all of these at once. Any solution will lead to some level of change in the core beyond adding a hook or two or even a few.
Has anyone already thought through a potential solution? I have some ideas, but I know there are others who know the code better than me.
I think it'd be helpful to have a similar system that allows the locking of certain features generally and default settings on an account (or preferably, both an account and a per-channel) basis - though, until we get to the end of the "appification" process, I think that should wait.