Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-7266

Top Active Members script does not link global users properly in created workspace

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Major
    • None
    • 3.3-rc-1
    • {Unused} Workspaces
    • None
    • Unknown

    Description

      In this script:

      code
      velocity

        1. Max number of contributors to display.
          #set ($MAX_CONTRIBUTORS = 5)
        2. We fetch a bit more contributors than needed to include some users that might be ignored.
          #set ($FETCHED_CONTRIBUTORS = $MAX_CONTRIBUTORS + 5)
        3. Whether to ignore the main global admin or not.
          #set ($IGNORE_GLOBAL_ADMIN = true)
          ##
          #set ($contributors = $xcontext.xWiki.store.search("select ase.user from ActivityEventImpl ase GROUP BY ase.user ORDER BY count DESC", $FETCHED_CONTRIBUTORS, 0, $xcontext.context))
          #set ($validContributors = 0)
          #foreach ($contributor in $contributors)
        4. It seems that we can have empty users in the table.
        5. We also ignore superadmin since he 'should not exist'.
        6. We also ignore the workspace template admin since it's a side-effect of bug http://jira.xwiki.org/jira/browse/XWIKI-6261
        7. We also ignore a 'ghost' local admin for workspaces since it should no longer exist.
          #if ("$!contributor" != '' && !$contributor.endsWith('superadmin') && "$!contributor" != 'workspacetemplate:XWiki.Admin' &&
          ( !$IGNORE_GLOBAL_ADMIN || ($IGNORE_GLOBAL_ADMIN && "$!contributor" != 'xwiki:XWiki.Admin' ) ) &&
          ( $xcontext.mainWiki || (!$xcontext.mainWiki && "$!contributor" != 'XWiki.Admin') )
          )
          #set ($validContributors = $validContributors + 1)
          #set ($userDocumentReference = $services.model.resolveDocument($contributor))
          #set ($userDocument = $xwiki.getDocument($userDocumentReference))
          #set ($userObject = $userDocument.getObject('XWiki.XWikiUser'))
          #set ($displayName = "$! {userDocument.getValue('first_name')}

          $!

          {userDocument.getValue('last_name')}

          ")
          #set ($displayName = $displayName.trim())
          #if ("$!displayName" == '')
          #set ($displayName = $userDocumentReference.name)
          #end
          1. [[$displayName>>$!

          {contributor}

          ]]
          #end
          #if ($validContributors == $MAX_CONTRIBUTORS)
          #break
          #end
          #end

      To see the full list of workspace members, you can use the [[User Directory>>Main.UserDirectory]] page.
      /velocity
      code

      The $contributor is a local reference. When displayed in a child wiki the link is bad

      Attachments

        Issue Links

          Activity

            People

              ludovic Ludovic Dubost
              ludovic Ludovic Dubost
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: