Package org.apache.wiki.tags

# Class PermissionTag

java.lang.Object
jakarta.servlet.jsp.tagext.TagSupport
org.apache.wiki.tags.WikiTagBase
org.apache.wiki.tags.PermissionTag

All Implemented Interfaces:
  `jakarta.servlet.jsp.tagext.IterationTag`, `jakarta.servlet.jsp.tagext.JspTag`, `jakarta.servlet.jsp.tagext.Tag`, `jakarta.servlet.jsp.tagext.TryCatchFinally`, `Serializable`

public class PermissionTag extends WikiTagBase
Tells whether the user in the current wiki context possesses a particular permission. The permission is typically a PagePermission (e.g., "edit", "view", "delete", "comment", "upload"). It may also be a wiki-wide WikiPermission ("createPages", "createGroups", "editProfile", "editPreferences", "login") or the administrator permission ("allPermission"). GroupPermissions (e.g., "viewGroup", "editGroup", "deleteGroup").

Since 2.6, it is possible to list several permissions or use negative permissions, e.g.

         <wiki:Permission permission="edit|rename|view">
            You have edit, rename, or  view permissions!
         </wiki:Permission>

or

         <wiki:Permission permission="!upload">
            You do not have permission to upload!
         </wiki:Permission>

Since:
  2.0
See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class org.apache.wiki.tags.WikiTagBase

`m_wikiContext`

### Fields inherited from class jakarta.servlet.jsp.tagext.TagSupport

`id, pageContext`

### Fields inherited from interface jakarta.servlet.jsp.tagext.IterationTag

`EVAL_BODY_AGAIN`

### Fields inherited from interface jakarta.servlet.jsp.tagext.Tag

`EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE`

## Constructor Summary

Constructors
Constructor
Description
`PermissionTag()`

## Method Summary

Modifier and Type
Method
Description
`final int`
`doWikiStartTag()`
Initializes the tag.
`void`
`initTag()`
Initializes the tag.
`void`
`setPermission(String permission)`
Sets the permissions to look for (case sensitive).

### Methods inherited from class org.apache.wiki.tags.WikiTagBase

`doCatch, doEndTag, doFinally, doStartTag, setId, setPageContext`

### Methods inherited from class jakarta.servlet.jsp.tagext.TagSupport

`doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setParent, setValue`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### PermissionTag

public PermissionTag()

## Method Details

### initTag

public void initTag()
Initializes the tag.

Overrides:
  `initTag` in class `WikiTagBase`

### setPermission

public void setPermission(String permission)
Sets the permissions to look for (case sensitive). See above for the format.

Parameters:
  `permission` - A list of permissions

### doWikiStartTag

public final int doWikiStartTag()
Initializes the tag.

Specified by:
  `doWikiStartTag` in class `WikiTagBase`
Returns:
  the result of the tag: SKIP_BODY or EVAL_BODY_CONTINUE