Clarify app manager method names #49648
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Renames isInstalled -> isEnabledForAnyone, and getInstalledApps -> getEnabledApps.
There is a weird situation for apps which are enabled only for some groups of users:
For isEnabled*, one can use isEnabledForUser($app, null), to check if the app is enabled for everyone.
But for getEnabled*, there is no equivalent, as getEnabledForUser parameter is mandatory.
Because of that, in NavigationManager, isEnabledForUser is called on each app returned by getInstalledApps.
We could consider that when there is no user in session we should always exclude apps enabled only for some groups, and I think for public pages it makes sense (does it?).
But the issue is for
occ
cli tool, there there is no user in session but we do want to consider app enabled for some groups only as enabled.So basically for each getInstalledApps call, we should ask ourselves whether the list should include partially-enabled apps or not, and replace with the appropriate method call.
We may want to rename getEnabledApps with a more precise name, but getEnableAppsForAnyone is ugly, no?
We may want to add a way to get apps enabled for everyone, either as a new method or by making the parameter nullable in getEnabledAppsForUser.
Checklist