Package org.apache.wiki.tags

# Class UserProfileTag

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

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 UserProfileTag extends WikiTagBase

Returns user profile attributes, or empty strings if the user has not been validated. This tag has a single attribute, "property." The `property` attribute may contain one of the following case-insensitive values:

- `created` - creation date
- `email` - user's e-mail address
- `fullname` - user's full name
- `groups` - a sorted list of the groups a user belongs to
- `loginname` - user's login name. If the current user does not have a profile, the user's login principal (such as one provided by a container login module, user cookie, or anonyous IP address), will supply the login name property
- `roles` - a sorted list of the roles a user possesses
- `wikiname` - user's wiki name
- `modified` - last modification date
- `exists` - evaluates the body of the tag if user's profile exists in the user database
- `new` - evaluates the body of the tag if user's profile does not exist in the user database
- `canChangeLoginName` - always true if custom auth used; also true for container auth and current UserDatabase.isSharedWithContainer() is true.
- `canChangePassword` - always true if custom auth used; also true for container auth and current UserDatabase.isSharedWithContainer() is true.

In addition, the values `exists`, `new`, `canChangeLoginName` and `canChangeLoginName` can also be prefixed with `!` to indicate the negative condition (for example, `!exists`).

Since:
  2.3
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`BLANK`

### 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
`UserProfileTag()`

## Method Summary

Modifier and Type
Method
Description
`final int`
`doWikiStartTag()`
This method is allowed to do pretty much whatever he wants.
`void`
`initTag()`
This method is called when the tag is encountered within a new request, but before the setXXX() methods are called.
`static String`
`printGroups(org.apache.wiki.api.core.Context context)`
Returns a sorted list of the `Group` objects a user possesses in his or her Session.
`static String`
`printRoles(org.apache.wiki.api.core.Context context)`
Returns a sorted list of the `Role` objects a user possesses in his or her Session.
`void`
`setProperty(String property)`

### 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`

## Field Details

### BLANK

public static final String BLANK

See Also:
  - Constant Field Values

## Constructor Details

### UserProfileTag

public UserProfileTag()

## Method Details

### initTag

public void initTag()
Description copied from class: `WikiTagBase`
This method is called when the tag is encountered within a new request, but before the setXXX() methods are called. The default implementation does nothing.

Overrides:
  `initTag` in class `WikiTagBase`

### doWikiStartTag

public final int doWikiStartTag() throws IOException
Description copied from class: `WikiTagBase`
This method is allowed to do pretty much whatever he wants. We then catch all mistakes.

Specified by:
  `doWikiStartTag` in class `WikiTagBase`
Throws:
  `IOException`

### setProperty

public void setProperty(String property)

### printGroups

public static String printGroups(org.apache.wiki.api.core.Context context)
Returns a sorted list of the `Group` objects a user possesses in his or her Session. The result is computed by consulting `Session.getRoles()` and extracting those that are of type Group.

Returns:
  the list of groups, sorted by name

### printRoles

public static String printRoles(org.apache.wiki.api.core.Context context)
Returns a sorted list of the `Role` objects a user possesses in his or her Session. The result is computed by consulting `Session.getRoles()` and extracting those that are of type Role.

Returns:
  the list of roles, sorted by name