cogA more user friendly application for managing rights to groups.
Developed by

Paul Pantiru, Denis Gervalle

Active Installs6
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager


A more user friendly application for managing rights to groups. It replaces the default Rights UI (using checkboxes to set rights) by one which offers dropdown lists for setting rights. Although it has fewer options, if the need appears for setting some advanced combination of rights, you can still access the old UI by clicking the "Go to advanced" link on the top right.


Setting rights

Currently there are a finite number of combinations of rights from which you can chose.
The predefined options are:

  • View
  • View and comment
  • View, comment and edit
  • View, comment, edit and delete

If the rights object contains a combination of rights not part of this options, the dropdown menu will take the value of Advanced.
Choosing one of the options will overwrite the Advanced options.

Adding more options

You can add new options easely by editing XWiki.AdminRightsTranslations and adding new lines in the rightuisimplifier.levels.level and rightuisimplifier.levels.label sections.
rightuisimplifier.levels.label_n - this will set the label

rightuisimplifier.levels.level_n - this will actually add the option
where n represents the n-th option in the list
Keep in mind that the ns must be consecutive.
rightuisimplifier.levels.label_5=View,edit and delete

Dynamic Groups

You can define dynamic group filters, like the existing "Groups With rights" by going to the BasicRightFilters.WebHome page and selecting ADD NEW ENTRY.


You will then be asked to give the name of your new filter


After clicking the little "+" icon, a new page for your filter will be created and you will be prompted in the edit mode for this page, where you can actually define your filter.


The ACTIVATE check-box if ticked will add your new filter as an option in the rights manager ui, as a selectable radio-button. (You can activate/deactivate it any time by editing the page of you filter)

The label is the name you will see next to the radio-button in the rights manager ui.

And the CODE is where you actually define your new filter using velocity code(as an example, below you can see the code for "Groups with rights" filter).

{{velocity output="false"}}
  #macro(getRows $uorg $clsname $filterMap $offset $limit $results $matchedCount)
    #set($rows = [])
    #set($results = $util.null)
    #setVariable("$results" $rows)

    #getUsersOrGroup($uorg $filterMap 0 0 $users $count)
    #set($offlim = $offset + $limit)
    #set($count = 0)
    ##The variable $users may be a little deceiving since it can represent users or groups,
    ##in this case representing groups
    #foreach($user in $users)
      #getRights($user $clsname $uorg $rights)
      ##The following if statement is what filters all the groups to only those with rights
      #if ($rights.allows.size() > 0 || $rights.denys.size() > 0)
        #if ($count >= $offset && $count < $offlim)
          #set ($discard = $rows.add($rights))
        #set ($count = $count + 1)

    #set($matchedCount = $util.null)
    #setVariable("$matchedCount" $count)

Let's break down this code for a better understanding of how to write a new filter.
Basicaly for each filter that you want to create, you will need to define a new macro called getRows, which will be used for constructing the json for the livetable in another document.
This macro will have a bunch of parameters, 6 to be exact, 2 of which will be output parameters.

The input parameters:

$uorg          - if the page filter was named correctly, will either have the value of groups or users, depending on what the filter name starts with

$clsname   - is the name of the class used to set the rights and it can either be XWiki.XWikiRights or XWiki.XWikiGlobalRights.

$filterMap   - the list of parameters after which we can filter the results in the table

 the $offset and the $limit are related to pagination and how many results will be displayed at once

The output parameters are:

$matchedCount   - which is the number of rows that are going to be returned for your filter
   -this will be provided by the call to tha macro #getUsersOrGroup through the output parameter $count

$results                - the actuall array of rows, each row takes it's value from the output parameter $rights of the #getRights macro
and is composed of: 

  • user which is either a user or a group to which you can asign rights from the livetable
  • allows which is the list of rights the "user" has
  • denys which is a list of rights the "user" has been denyed of

Macro calls:

#getUsersOrGroup - The first gets a filtered list of users or groups from the user API
Output parameters:

  • $users - the list of users or groups that we can set rights for in the livetable
  • $count - the number of users or groups returned by "$users"

#getRights - The second gets rights for a user/group on the current entity using given right object
Output parameter:

  • $rights

The #foreach($user in $users) loop, goes through all the users/groups (depending on the what your filter si based on i.e.: the prefix you choose for your page name), and you will have to write your velocity code describing when the rows are added and when they are skipped (i.e. when is the line #set ($discard = $rows.add($rights)) executed)


This extension cannot be simply uninstalled with the Extension Manager.
If you wish to uninstall this extension in addition to the classical uninstall from EM you also need to manually revert the XWiki.AdminRightsSheet (and XWiki.AdminPageRightsSheet for >7.2, and XWiki.AdminPageAndChildrenRightsSheet for >7.4) document(s) to a version before you first installed this extension, this is done from the history section of the specified document.
This is because this extension changes the above mentioned core document.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

Release Notes





Dependencies for this extension (org.xwiki.contrib:application-rightsui-simplifier 1.2):

  • org.xwiki.platform:xwiki-platform-oldcore 5.4
Created by Paul Panțiru on 2015/11/13 19:27

Get Connected