Uploaded image for project: '{RETIRED} XWiki Enterprise'
  1. {RETIRED} XWiki Enterprise
  2. XE-1053

Activity macro throwing exceptions in the console for message events when logged in as a non-admin user

    XMLWordPrintable

Details

    • activity macro exception console messages

    Description

      How to reproduce:
      1. Create a new non-admin user and log in with it
      2. Got to the homepage and post a message to everyone
      3. Look at the console and see a stacktrace made up of 3 almost identical exceptions of type:

      Wrapped Exception: Error number 3301 in 3: Exception while switching to database [xwiki:xwiki]
      Wrapped Exception: Unknown database 'xwiki:xwiki'
              at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:853)
              at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:283)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1449)
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1503)
              at com.xpn.xwiki.user.impl.xwiki.XWikiRightServiceImpl.hasAccessLevel(XWikiRightServiceImpl.java:596)
              at com.xpn.xwiki.user.impl.xwiki.XWikiRightServiceImpl.hasAccessLevel(XWikiRightServiceImpl.java:313)
              at com.xpn.xwiki.api.XWiki.hasAccessLevel(XWiki.java:1664)
              at sun.reflect.GeneratedMethodAccessor156.invoke(Unknown Source)
      

      The problem is that, in Main.Activity the following check exists for each page of an event:

      #if (($xwiki.hasAccessLevel('view', $context.user, "${context.database}:${pageName}") && !$iterationDocuments.contains($pageName)) || $pageName.matches(".*:XWiki[.][0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}"))
      

      The solution is to swap the OR elements so that message events are checked before falling back on view rights checking and the exceptions are avoided (since the "${context.database}:${pageName}" assumption also gets skipped).

      Attachments

        Issue Links

          Activity

            People

              enygma Eduard Moraru
              enygma Eduard Moraru
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: