Uploaded image for project: '{RETIRED} XWiki Administration Application'
  1. {RETIRED} XWiki Administration Application
  2. XAADMINISTRATION-35

Administrative users get their own setting on usertype, and not the setting for the user whose profile they're viewing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 1.10
    • 1.9
    • Users, Groups, Rights
    • None
    • usertype, isAdvanced, profile, patch

    Description

      When a user with administrative access looks at another user's profile, the option to switch from simple to advanced user reflects the logged in user's setting and not the profile's

      This is the code involved:
      from frequentlyUsedDocs.vm, set crtUserDoc to the currently logged in user doc
      #set($crtUserDoc = $!xwiki.getDocument($context.user))

      in xwikivars.vm determine the isAdvanced var from the $crtUserDoc
      #set($userObj = $!crtUserDoc.getObject("XWiki.XWikiUsers",0))

        1. =====================================================================================
        2. Advanced users are:
        3. - super admin
        4. - user documents who have their usertype property set to "Advanced"
        5. - guest users who have admin rights (i.e. when the wiki is empty with no rights set)
        6. =====================================================================================
          #if($context.user == "XWiki.superadmin")
          #set($isAdvancedUser = true)
          #elseif($isGuest && $hasAdmin)
          #set($isAdvancedUser = true)
          #elseif(!$userObj.getProperty("usertype").value)
          #set($isAdvancedUser = false)
          #else
          #set($isAdvancedUser = ($userObj.getProperty("usertype").value == "Advanced"))
          #end

      And finally in XWIkiUserSheet, if the user is advanced, show the switch to simple.
      #if($isAdvancedUser)

      • <img alt="" src="$xwiki.getSkinFile("icons/simpleuser.png")"/> <a href="$doc.getURL("save", "XWiki.XWikiUsers_${obj.number}_usertype=Simple")">$msg.get("platform.core.profile.switchSimple")</a>
        #else
      • <img alt="" src="$xwiki.getSkinFile("icons/advanceduser.png")"/> <a href="$doc.getURL("save", "XWiki.XWikiUsers_${obj.number}_usertype=Advanced")">$msg.get("platform.core.profile.switchAdvanced")</a>
        #end

      I think part of the reason this happened is because the comment above this section is incorrect. It states that the whole section is shown only for the current user ( ## Note: This menu is only displayed if the current profile page is

        1. that of the currently logged user), but in fact it is also shown for administrative users ( #if($isMyProfile || $xwiki.hasAdminRights()))

      An different issue is that XWikiUser defines the values for this property to be Basic and Advanced but the profile editor sets it to either Simple or Advanced.

      Attachments

        Activity

          People

            arunreddy Arun Reddy
            rgill Regan Gill
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: