com.xpn.xwiki.api
Class User

java.lang.Object
  extended by com.xpn.xwiki.api.Api
      extended by com.xpn.xwiki.api.User

public class User
extends Api

Scriptable API for easy handling of users. For the moment this API is very limited, containing only one method. In the future it should be extended to provide useful methods for working with users.

Since:
Platform-1.0

Field Summary
protected static org.slf4j.Logger LOGGER
          Logging helper object.
 
Fields inherited from class com.xpn.xwiki.api.Api
context
 
Constructor Summary
User(XWikiUser user, XWikiContext context)
          Constructs a wrapper for the given protected XWikiUser object.
 
Method Summary
 String getEmail()
          API to retrieve the e-mail address of this user.
 XWikiUser getUser()
          Expose the wrapped XWikiUser object.
protected  boolean isMain()
           See if the user is global (i.e.
 boolean isUserInGroup(String groupName)
          Check if the user belongs to a group or not.
 
Methods inherited from class com.xpn.xwiki.api.Api
convert, convert, getXWikiContext, hasAccessLevel, hasAdminRights, hasProgrammingRights, hasWikiAdminRights
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final org.slf4j.Logger LOGGER
Logging helper object.

Constructor Detail

User

public User(XWikiUser user,
            XWikiContext context)
Constructs a wrapper for the given protected XWikiUser object.

Parameters:
user - The XWikiUser object that should be wrapper.
context - The current context.
Method Detail

getUser

@Programming
public XWikiUser getUser()
Expose the wrapped XWikiUser object. Requires programming rights.

Returns:
The wrapped XWikiUser object, or null if the user does not have programming rights.

isUserInGroup

public boolean isUserInGroup(String groupName)
Check if the user belongs to a group or not.

Parameters:
groupName - The group to check.
Returns:
true if the user does belong to the specified group, false otherwise or if an exception occurs.

isMain

protected boolean isMain()

See if the user is global (i.e. registered in the main wiki) or local to a virtual wiki.

This method is not public, as the underlying implementation is not fully functional

Returns:
true if the user is global, false otherwise or if an exception occurs.

getEmail

public String getEmail()
API to retrieve the e-mail address of this user. This e-mail address is taken from the user profile. If the user hasn't changed his profile, then this is the e-mail address he filled in the registration form.

Returns:
The e-mail address from the user profile, or null if there is an error retrieving the email.
Since:
1.1.3, 1.2.2, 1.3M2