Condition Macro

Last modified by Admin on 2016/10/25 00:14

cogAllow the content to execute based on whether the user has the permission to do so.
TypeXAR
CategoryApplication
Developed by

Mohamed Boussaa

Active Installs1
Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1
Installable with the Extension Manager

Description

Condition macro allow the content to execute based on whether the user has the rights to do so.

Usage

Check if the current user has edit rights on the current document

{{condition rights="edit"}}
You can use the current document to try out your wiki's features.
{{/condition}}

Check if the current user has edit rights on an other document in a subwiki

{{condition rights="edit" reference="mywiki:Sandbox.WebHome"}}
You can use the [[Sandbox space>>mywiki:Sandbox.WebHome]] to try out your wiki's features.
{{/condition}}

You can specify several access rights

{{condition rights="view,edit,admin"}}
...
{{/condition}}

Parameters definition

NameValueDefault valueDescription
rightsStringThe rights that will be checked, this parameter is mandatory.
referenceStringThe current documentThis is the reference of a document on which the verification will be done.

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

Dependencies

Dependencies for this extension (org.xwiki.contrib:macro-condition 1.0):

  • org.xwiki.platform:xwiki-platform-rendering-wikimacro-store 7.4
Tags:
Created by Mohamed Boussaa on 2016/03/29 15:56
    

Get Connected