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

Allow direct control of livetable actions display

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0 M3
    • Fix Version/s: 3.0 RC1
    • Labels:
      None
    • keywords:
      livetable action visibility custom patch
    • Difficulty:
      Unknown
    • Similar issues:

      Description

      Currently there is no way to specify, using the json results, which actions to show and which not to show, especially for (but not limited to) custom actions.

      In the current implementation, it is required to have edit rights for an item in order to see any action or to be an admin:

      macros.vm
      #foreach($action in $colprop.get("actions"))
        if(row.doc_hasadmin || '${action}' == 'view' || (row.doc_hasdelete && '${action}' == 'delete') || (row.doc_hasedit && adminActions.indexOf('${action}') < 0) && '${action}' != 'delete'){
      ...
      

      An improvement to this is to use the row.doc_has<action> as a convention and allow each action to specify if it should be displayed or not:

      macros.vm
      #foreach($action in $colprop.get("actions"))
        if(row.doc_has${action} || '${action}' == 'view' || (row.doc_has${action} == undefined && (row.doc_hasadmin || adminActions.indexOf('${action}') < 0))) {
      ...
      

      Note: This also allows overriding an admin's action visibility. This makes sense when dealing with custom actions. If no 'override' is specified, the action is displayed by default, as it does now.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sdumitriu Sergiu Dumitriu
                Reporter:
                enygma Eduard Moraru
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

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