Yes, I know, with "nested pages" there is no longer such a thing as a space, but some folks would like to prevent the creation of "spaces" (aka top level pages), as they know it from XWiki 6.x
The idea behind this wish is not to clutter up the top level of the navigation with pages that got just created "somewhere". Users are allowed to "clutter", but please inside some defined spaces down the page hierarchy, so at least the initial navigation step only offers a few defined places.
However if one follows the guide here:
the result is indeed that:
- users can not create top level pages
- users can create child pages for the pages where they got edit rights
- but they only come to the create view if they type in the url manually
- the usual icon is not shown for pages where they can edit, and in principle could create pages
The rationale for not showing the create button this is that they can change the location in the "create" view before creating the page, i.e. to a top level location.
Somewhat inconsistently, they can copy an existing page, however, and the UI allows them to select a location where they cannot create the page (and the copy fails then, of course)
So instead of hiding the create button, but show the copy action which allows loosely the same action, I propose:
a) to use $hasCreatePage for both menu entries
b) to hide the location picker in the create / rename view instead, if $hasCreateSpace is not given.
Maybe even better would be to restrict the tree to locations where the user can edit, but that means cluttering the tree macro even more, so just hiding the location picker might be good enough.