XWiki Platform
  1. XWiki Platform
  2. XWIKI-9479

In multiwiki mode user picker field should automatically look by default for local or global users depending on the multiwiki type

    Details

    • Development Priority:
      High
    • Difficulty:
      Easy
    • Documentation:
      N/A
    • Similar issues:

      Description

      In 5.2 it has become possible to search for local/global users in the user picker. However the default behavior is not always the right one depending on the type of wiki farm.

      1/ If you are in the cloud mode, you actually want to ONLY look for local users, hidding all global users from the picker

      2/ If you are in farm mode you will want to default to global users, and either have or not the local user option (this could be a setting). Also we could have an option in the wiki to decide to still default or to only display local users.

      We might need a setting in xwiki.cfg to know the farm mode

        Issue Links

          Activity

          Hide
          Marius Dumitru Florea added a comment -

          The test could be written like this:

          #if ($isWorkspace)
            ## Global users only.
          #elseif (???)
            ## Both global and local users. Display the local/global scope toggle.
            #if (???)
              ## Scope toggle set to global by default.
            #else
              ## Scope toggle set to local by default.
            #end
          #else
            ## Local users only.
          #end
          

          What's missing is:

          • the condition for displaying the scope toggle
          • the condition for deciding the default value for the scope toggle.

          So I need to know if a wiki is isolated from the rest or not (local users only vs. both local and global users).

          Show
          Marius Dumitru Florea added a comment - The test could be written like this: #if ($isWorkspace) ## Global users only. #elseif (???) ## Both global and local users. Display the local/global scope toggle. #if (???) ## Scope toggle set to global by default. #else ## Scope toggle set to local by default. #end #else ## Local users only. #end What's missing is: the condition for displaying the scope toggle the condition for deciding the default value for the scope toggle. So I need to know if a wiki is isolated from the rest or not (local users only vs. both local and global users).
          Hide
          Vincent Massol added a comment -

          All I'm saying is that ideally this code should be replaced by an extension point (or more generically some inversion of control) and one of the wiki modules would provide the logic to evaluate whether the current wiki has local or global users. So that if no wiki module is present then this picker would still work without any hardcoded link to the notion of wiki.

          That's a generic topic of discussion for the platform but that's the direction we're taking with extensions so we need to have this in mind and start removing the hardcodings we have. The downside is performance and complexity.

          That's unless we say that the notion of wiki is not optional but if we want xwiki to be a dev platform for all type of use cases I think we can easily find use cases without the notion of (sub)wikis.

          WDYT?

          Show
          Vincent Massol added a comment - All I'm saying is that ideally this code should be replaced by an extension point (or more generically some inversion of control) and one of the wiki modules would provide the logic to evaluate whether the current wiki has local or global users. So that if no wiki module is present then this picker would still work without any hardcoded link to the notion of wiki. That's a generic topic of discussion for the platform but that's the direction we're taking with extensions so we need to have this in mind and start removing the hardcodings we have. The downside is performance and complexity. That's unless we say that the notion of wiki is not optional but if we want xwiki to be a dev platform for all type of use cases I think we can easily find use cases without the notion of (sub)wikis. WDYT?
          Hide
          Marius Dumitru Florea added a comment -

          [..] unless we say that the notion of wiki is not optional [..]

          Isn't the notion of wiki part of the new model? I see you coded a WikiEntity and a Server whose documentation says:

          An XWiki Server is made of one or several {@link WikiEntity}s. This is the top most concept of the XWiki Model.

          So isn't this the direction we're taking? that the model supports (sub)wikis by default?

          Regarding the user picker, I find the usage of an extension point an overhead that doesn't bring much. I prefer to use a script service and to write the Velocity code so that it fails safely if that script service is not present:

          #if ($services.wiki.hasLocalUserSupport())
            #if ($hasAccessToMainWiki)
              ## Both local and global users. Display the local/global scope toggle.
              #if ($isCurrentUserGlobal)
                ## Scope toggle set to global by default.
              #else
                ## Scope toggle set to local by default.
              #end
            #else
              ## Local users only.
            #end
          #else
            ## Global users only.
          #end
          

          What's missing is $services.wiki.hasLocalUserSupport() which is going to be added by Guillaume Delhumeau really soon I hope. As for the $hasAccessToMainWiki test it should be the same check we're going to do for the Home menu (XWIKI-9518). For me they are related: if the current user can see the Home menu then he has access to the main wiki and thus he should be able to get global user suggestions using the user picker.

          Show
          Marius Dumitru Florea added a comment - [..] unless we say that the notion of wiki is not optional [..] Isn't the notion of wiki part of the new model? I see you coded a WikiEntity and a Server whose documentation says: An XWiki Server is made of one or several {@link WikiEntity}s. This is the top most concept of the XWiki Model. So isn't this the direction we're taking? that the model supports (sub)wikis by default? Regarding the user picker, I find the usage of an extension point an overhead that doesn't bring much. I prefer to use a script service and to write the Velocity code so that it fails safely if that script service is not present: #if ($services.wiki.hasLocalUserSupport()) #if ($hasAccessToMainWiki) ## Both local and global users. Display the local/global scope toggle. #if ($isCurrentUserGlobal) ## Scope toggle set to global by default. #else ## Scope toggle set to local by default. #end #else ## Local users only. #end #else ## Global users only. #end What's missing is $services.wiki.hasLocalUserSupport() which is going to be added by Guillaume Delhumeau really soon I hope. As for the $hasAccessToMainWiki test it should be the same check we're going to do for the Home menu ( XWIKI-9518 ). For me they are related: if the current user can see the Home menu then he has access to the main wiki and thus he should be able to get global user suggestions using the user picker.
          Hide
          Marius Dumitru Florea added a comment -

          Note that we're using $services.csrf.* in lots of places for instance. CSRF module is optional so "ideally" (taking your suggestion to the extreme ) all those places should have an extension point instead and the CSRF module should push the code there. It's a pain to do this and it doesn't bring much value IMO.

          Show
          Marius Dumitru Florea added a comment - Note that we're using $services.csrf.* in lots of places for instance. CSRF module is optional so "ideally" (taking your suggestion to the extreme ) all those places should have an extension point instead and the CSRF module should push the code there. It's a pain to do this and it doesn't bring much value IMO.
          Hide
          Thomas Mortagne added a comment - - edited

          Note that Guillaume is currently working on new wiki APIs and among other things a script service that will indicate if users in a wiki are local, global or both. See mailing list. I guess the simplest will then be to use this new API in the user picker.

          Show
          Thomas Mortagne added a comment - - edited Note that Guillaume is currently working on new wiki APIs and among other things a script service that will indicate if users in a wiki are local, global or both. See mailing list. I guess the simplest will then be to use this new API in the user picker.
          Hide
          Marius Dumitru Florea added a comment -

          I used Guillaume Delhumeau's new Wiki API in the end to provide suggestions based on the user scope.

          Show
          Marius Dumitru Florea added a comment - I used Guillaume Delhumeau 's new Wiki API in the end to provide suggestions based on the user scope.
          Hide
          Anca Luca added a comment -

          I don't know if there is an issue reported for this, but I think that it would be very interesting to be able configure the type of users when creating the user property in the class: workspace default, local or global or both.

          This feature could be very interesting in the case of groups, where the fix for this issue is removing a problem but introducing another: in the "workspace case" (global users only), you can have local groups to setup various rights for the global users. This selector will force global groups, when one might want to choose from the local ones.

          Show
          Anca Luca added a comment - I don't know if there is an issue reported for this, but I think that it would be very interesting to be able configure the type of users when creating the user property in the class: workspace default, local or global or both. This feature could be very interesting in the case of groups, where the fix for this issue is removing a problem but introducing another: in the "workspace case" (global users only), you can have local groups to setup various rights for the global users. This selector will force global groups, when one might want to choose from the local ones.
          Hide
          Marius Dumitru Florea added a comment - - edited

          Anca Luca we can fix the problem with the groups by having a different behaviour in the group displayer:

          • if the user scope is local only or we are on the main wiki then suggest only local groups
          • otherwise (subwiki with user scope != local only) display the scope toggle

          WDYT?

          Show
          Marius Dumitru Florea added a comment - - edited Anca Luca we can fix the problem with the groups by having a different behaviour in the group displayer: if the user scope is local only or we are on the main wiki then suggest only local groups otherwise (subwiki with user scope != local only) display the scope toggle WDYT?
          Hide
          Anca Luca added a comment -

          sounds good to me (better than before, at least). However, I think it could still be interesting to configure it in the class, but it's less pressing if we have a solution for the groups.

          Show
          Anca Luca added a comment - sounds good to me (better than before, at least). However, I think it could still be interesting to configure it in the class, but it's less pressing if we have a solution for the groups.

            People

            • Assignee:
              Marius Dumitru Florea
              Reporter:
              Ludovic Dubost
            • Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: