Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar config not displayed to Admin user #73

Closed
ldubost opened this issue Dec 10, 2021 · 15 comments
Closed

Calendar config not displayed to Admin user #73

ldubost opened this issue Dec 10, 2021 · 15 comments

Comments

@ldubost
Copy link

ldubost commented Dec 10, 2021

When going to the new Calendar settings panel developed in #67 in admin to change the "show meetings" configuration, there is the following error:

image

However when clicking on the MoccaCalendar.Code.AdminSheet link you can there edit the setting

image

It could be an issue because of the non editability of AdminSheet as it's part of a pro extension

@ClemensRobbenhaar
Copy link
Collaborator

ClemensRobbenhaar commented Dec 12, 2021

This looks like some odd permission problem. I cannot reproduce it in my development instance.
Is the problem present in a sub wiki or the main wiki?

@ane-gabriela
Copy link

Hello! I've also reproduce this issues using XWiki 13.10 and 13.4.5 as instance Admin on Main and Subwikis

Administration

I think it's possibly the same issue as XQA-360

@mflorea
Copy link

mflorea commented Dec 16, 2021

@ClemensRobbenhaar the administrator needs to have:

  • view right on the page that has the ConfigurableClass in order to see the administration section listed in the administration menu -> this means you need to generate a license first if the administration section is provided by a licensed extension
  • edit right on the page that has the ConfigurableClass in order to view (render) the administration section inside the administration -> this means you need to exclude the administration section from the license check because all pages provided by a licensed extensions have edit protection by default.

Take a look at the Antivirus Application for an example https://github.com/xwikisas/application-antivirus/blob/master/application-antivirus-ui/pom.xml#L38 .

I see that the page that holds the configuration, MoccaCalendar.Code.GlobalSettings, is created on the fly (not included in the XAR) so you won't have to exclude it in the pom. Note that since you're going to exclude MoccaCalendar.Code.AdminSheet from license check and thus allow administrators to edit it, you should move the code to a different page that is protected by the license. So best is to have:

<codeToExecute>{{include reference="MoccaCalendar.Code.AdminSheetCode" /}}</codeToExecute>

in MoccaCalendar.Code.AdminSheet, where MoccaCalendar.Code.AdminSheetCode is protected. The main reason to protect the code is to reduce support costs.

ClemensRobbenhaar added a commit that referenced this issue Dec 16, 2021
- move actual sheet code to separate page and
  make the AdminSheet section unprotected
  (same for the "GlobalSettings" page, even
  though it is not contained in the package
  but created on the fly, just in case ...)
@ClemensRobbenhaar
Copy link
Collaborator

ClemensRobbenhaar commented Dec 16, 2021

I tried to get it fixed along the given lines. However I am not sure if I did it right, so not closing it for now.

Edit to add: It seems not to work, as on import the "scope:WIKI" settings of the page MoccaCalendar.Code.AdminSheetCode, class XWiki.ConfigurableClass seems not to be imported. After setting it manually via the object editor it works, but that is definitely not how it is supposed to happen. Checked with platform version 13.10

@mflorea
Copy link

mflorea commented Jan 19, 2022

@ClemensRobbenhaar the ConfigurableClass object needs to remain on the AdminSheet page, because the page holding this object needs to be editable. AdminSheetCode should have only the code that is included in codeToExecute from AdminSheet's ConfigurableClass object.

Also, be careful about the scope property. The Calendar Application supports XWiki 11.10 ATM while the scope property has been introduced recently in https://jira.xwiki.org/browse/XWIKI-18723 (XWiki 13.7RC1). You should use the old configureGlobally property which is still supported in the latest version of XWiki.

@ClemensRobbenhaar
Copy link
Collaborator

Ah, that is why the scope property sometimes worked and sometimes not.
I will try to fix both issues this evening.

@ClemensRobbenhaar
Copy link
Collaborator

I fixed both the missing configureGlobally property and the XAR format.
About the location of the XWiki.ConfigurableClass object: I am not sure if the location of that object matters, as the object itself should not be edited by the users. The actual settings to be edited are stored (manually via some code in the AdminSheetCode) on the page MoccaCalendar.Code.GlobalSettings. This page is not included in the application, but created on demand.

@mflorea
Copy link

mflorea commented Jan 20, 2022

@ClemensRobbenhaar the problem, AFAIK, is that the Administration Application which provides the XWiki.ConfigurableClass doesn't include the sections (i.e. pages with an XWiki.ConfigurableClass objects) that are not editable. So unfortunately the page holding the XWiki.ConfigurableClass object needs to be excluded for the license check. Which is why our best practice is to keep only the XWiki.ConfigurableClass object on that page, without the actual code of your administration section. This should go in a separate page, included in codeToExecute.

@ClemensRobbenhaar
Copy link
Collaborator

Ah, that explains why the section sometimes does not show up at all. I will move the XWiki.ConfigurableClass to a separate page which is marked as <type>configuration</type> or the like in the pom.xml.

ClemensRobbenhaar added a commit that referenced this issue Jan 22, 2022
- move ConfigurebleClass object to its own page
  "MoccaCalendar.Code.AdminSheetConfig" and mark
  this as "config" page.
@ClemensRobbenhaar
Copy link
Collaborator

Moved the instance of the class to its own page MoccaCalendar.Code.AdminSheetConfig.
If someone else but me could test if that fixes the bug, I'd appreciate it.

@mflorea
Copy link

mflorea commented Jan 23, 2022

I don't understand why you didn't put the XWiki.ConfigurableClass in the AdminSheet page. ATM you have 3 pages:

  • AdminSheet just includes AdminSheetCode <- it's kind of useless
  • AdminSheetCode holds the actual code of the administration section <- this is useful
  • AdminSheetConfig holds the XWiki.ConfigurableClass and includes AdminSheet (BTW, it could include directly AdminSheetCode) <- as long as it's not listed in xwiki.extension.licensing.excludedDocuments the page is not editable so the administration section is not accessible so you didn't fix the problem

My suggestion was to have just 2 pages:

  • AdminSheet holds the XWiki.ConfigurableClass object and is listed in xwiki.extension.licensing.excludedDocuments (so that it becomes editable and thus accessible as an administration section). It also includes AdminSheetCode in the value of the codeToExecute property.
  • AdminSheetCode holds the actual code of the administration section, included in the value codeToExecute property of XWiki.ConfigurableClass.

ClemensRobbenhaar added a commit that referenced this issue Jan 24, 2022
- mostly revert last change; now the AdminSheet
  contains the menu configuration object, but no code,
  and is both listed as configuration and excluded
  from license restrictions
@ClemensRobbenhaar
Copy link
Collaborator

I thoroughly misunderstood your suggestions, sorry.

Next try: only AdminSheet and AdminSheetCode is present, and the AdminSheet only contains the XWiki.Configureable class, and no content.

@oanalavinia oanalavinia added this to the 2.11 milestone Mar 1, 2022
@ane-gabriela ane-gabriela reopened this Mar 7, 2022
@ane-gabriela
Copy link

Issue still present (XWiki 13.10.3 Cloud)

Admin

@ClemensRobbenhaar
Copy link
Collaborator

ClemensRobbenhaar added a commit that referenced this issue Mar 7, 2022
- pages that are excluded from edit restrictions should be comma
  separated, not separated by line breaks
@ClemensRobbenhaar ClemensRobbenhaar modified the milestones: 2.11, 2.11.1 Mar 8, 2022
@mflorea
Copy link

mflorea commented Apr 16, 2022

Seems to work fine in 2.11.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants