- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.xpn.xwiki.user.api.XWikiUser
类的一些代码示例,展示了XWikiUser
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWikiUser
类的具体详情如下:
包路径:com.xpn.xwiki.user.api.XWikiUser
类名称:XWikiUser
暂无
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public String getUser()
{
if (this.user != null) {
return this.user.getUser();
} else {
return XWikiRightService.GUEST_USER_FULLNAME;
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public User getUser(String username, XWikiContext context)
{
XWikiUser xwikiUser = new XWikiUser(username);
User user = new User(xwikiUser, context);
return user;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Check if the user belongs to a group or not.
*
* @param groupName The group to check.
* @param context The current {@link XWikiContext context}.
* @return <tt>true</tt> if the user does belong to the specified group, false otherwise or if
* an exception occurs.
* @throws XWikiException If an error occurs when checking the groups.
* @since Platform-1.3
*/
public boolean isUserInGroup(String groupName, XWikiContext context) throws XWikiException
{
if (!StringUtils.isEmpty(getUser())) {
XWikiGroupService groupService = context.getWiki().getGroupService(context);
DocumentReference groupReference = this.currentMixedDocumentReferenceResolver.resolve(groupName);
Collection<DocumentReference> groups = groupService.getAllGroupsReferencesForMember(getUserReference(context), 0, 0, context);
if (groups.contains(groupReference)) {
return true;
}
}
return false;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Make sure we can't loose context user if the context wiki change (i.e. set the prefixed full name of the user in
* the context).
*
* @deprecated this method does not exists and is useless in version 3.1 and more
*/
@Deprecated
private void normalizedContextUser(XWikiContext context)
{
if (context.getXWikiUser() != null) {
context.setUser(this.defaultEntityReferenceSerializer.serialize(this.currentMixedDocumentReferenceResolver
.resolve(context.getXWikiUser().getUser(),
new SpaceReference("XWiki", new WikiReference(context.getDatabase()))), context.getXWikiUser()
.isMain()));
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
username = XWikiRightService.GUEST_USER_FULLNAME;
} else {
username = user.getUser();
user = context.getWiki().checkAuth(context);
String creator = doc.getCreator();
if ((user != null) && (user.getUser() != null) && (creator != null)) {
if (user.getUser().equals(creator)) {
context.setUser(user.getUser());
user = context.getWiki().checkAuth(context);
} else {
user = new XWikiUser(context.getUser());
username = XWikiRightService.GUEST_USER_FULLNAME;
} else {
username = user.getUser();
username = user.getUser();
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* <p>
* See if the user is global (i.e. registered in the main wiki) or local to a virtual wiki.
* </p>
* <p>
* This method is not public, as the underlying implementation is not fully functional
* </p>
*
* @return <tt>true</tt> if the user is global, false otherwise or if an exception occurs.
*/
protected boolean isMain()
{
return user.isMain();
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Check if the user belongs to a group or not.
*
* @param groupName The group to check.
* @return <tt>true</tt> if the user does belong to the specified group, false otherwise or if
* an exception occurs.
*/
public boolean isUserInGroup(String groupName)
{
boolean result = false;
try {
if (this.user == null) {
LOG.warn("Invalid null user");
} else {
result = this.user.isUserInGroup(groupName, getXWikiContext());
}
} catch (Exception ex) {
LOG.warn(new MessageFormat("Unhandled exception while checking if user {0}"
+ " belongs to group {1}").format(new java.lang.Object[] {user, groupName}), ex);
}
return result;
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
} finally {
if (originalAuthor != null) {
xcontext.setUser(originalAuthor.getUser(), originalAuthor.isMain());
} else {
xcontext.setUser(null);
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public String toString()
{
return getUser();
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
context.setDatabase(currentWiki);
if (currentUser != null) {
context.setUser(currentUser.getUser(), currentUser.isMain());
} else {
context.setUser(null);
context.setDatabase(currentWiki);
if (currentUser != null) {
context.setUser(currentUser.getUser(), currentUser.isMain());
} else {
context.setUser(null);
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public void setUser(String user, boolean main)
{
if (user == null) {
this.user = null;
remove(USER_KEY);
} else {
this.user = new XWikiUser(user, main);
put(USER_KEY, user);
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
private DocumentReference getUserReference(XWikiContext context)
{
return this.currentMixedDocumentReferenceResolver.resolve(getUser());
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
context.setDatabase(currentWiki);
if (currentUser != null) {
context.setUser(currentUser.getUser(), currentUser.isMain());
} else {
context.setUser(null);
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
@Override
public XWikiUser checkAuth(XWikiContext context) throws XWikiException
{
String user = context.getRequest().getRemoteUser();
if ((user == null) || user.equals("")) {
return super.checkAuth(context);
} else {
if (log.isDebugEnabled())
log.debug("Launching create user for " + user);
createUser(user, context);
if (log.isDebugEnabled())
log.debug("Create user done for " + user);
user = "XWiki." + user;
}
context.setUser(user);
return new XWikiUser(user);
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
/**
* <p>
* Retrieve the XWiki user associated to the current XWiki context
* </p>
*
* @param componentManager The component manager to be used to retrieve the execution context.
* @return The user associated to the current XWiki context.
*/
public static String getXWikiUser(ComponentManager componentManager)
{
XWikiUser user = getXWikiContext(componentManager).getXWikiUser();
if (user == null) {
return "XWiki.Guest";
}
return user.getUser();
}
}
代码示例来源:origin: org.phenotips/lims-integration-api
/**
* Convert a username to an XWikiUser object, taking care of proper escapes.
*
* @param username the username to process
* @return an XWikiUser object holding the specified username
*/
private XWikiUser toXWikiUser(String username, XWikiContext context)
{
DocumentReference ref = new DocumentReference(context.getDatabase(), XWiki.SYSTEM_SPACE, username);
return new XWikiUser(ref.toString());
}
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
public boolean checkAccess(String action, XWikiDocument doc, XWikiContext context) throws XWikiException
{
if (action.equals("skin") && (doc.getSpace().equals("skins") || doc.getSpace().equals("resources"))) {
// We still need to call checkAuth to set the proper user.
XWikiUser user = checkAuth(context);
if (user != null) {
context.setUser(user.getUser());
}
return true;
}
return getRightService().checkAccess(action, doc, context);
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* {@inheritDoc}
*
* @see com.xpn.xwiki.user.impl.xwiki.XWikiAuthServiceImpl#checkAuth(com.xpn.xwiki.XWikiContext)
*/
@Override
public XWikiUser checkAuth(XWikiContext context) throws XWikiException
{
String user = context.getRequest().getRemoteUser();
LOG.debug(MessageFormat.format("Checking auth for remote user {0}", user));
if (StringUtils.isBlank(user)) {
return super.checkAuth(context);
} else {
user = this.extractUsernameFromPrincipal(user);
user = createUser(user, context);
user = XWIKI_SPACE + DOT + user;
}
context.setUser(user);
return new XWikiUser(user);
}
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-rest-server
if (xwikiUser != null) {
xwikiContext.setUser(xwikiUser.getUser().contains(":") ? xwikiUser.getUser() : xwikiContext
.getDatabase() + ':' + xwikiUser.getUser());
getLogger().log(Level.FINE, String.format("Authenticated as '%s'.", xwikiUser.getUser()));
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* We cannot authenticate locally since we need to trust the app server for authentication.
*/
@Override
public XWikiUser checkAuth(String username, String password, String rememberme, XWikiContext context)
throws XWikiException
{
String user = context.getRequest().getRemoteUser();
if ((user == null) || user.equals("")) {
return super.checkAuth(username, password, rememberme, context);
} else {
createUser(user, context);
user = "XWiki." + user;
}
context.setUser(user);
return new XWikiUser(user);
}
}
本文整理了Java中com.xpn.xwiki.user.api.XWikiUser.()方法的一些代码示例,展示了XWikiUser.()的具体用法。这些代码示例主要来源于Github/Stacko
本文整理了Java中com.xpn.xwiki.user.api.XWikiUser.getUser()方法的一些代码示例,展示了XWikiUser.getUser()的具体用法。这些代码示例主要来源
我是一名优秀的程序员,十分优秀!