gpt4 book ai didi

com.xpn.xwiki.user.api.XWikiRightService.hasAdminRights()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 05:23:05 34 4
gpt4 key购买 nike

本文整理了Java中com.xpn.xwiki.user.api.XWikiRightService.hasAdminRights()方法的一些代码示例,展示了XWikiRightService.hasAdminRights()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWikiRightService.hasAdminRights()方法的具体详情如下:
包路径:com.xpn.xwiki.user.api.XWikiRightService
类名称:XWikiRightService
方法名:hasAdminRights

XWikiRightService.hasAdminRights介绍

[英]Checks that the current user in the context (the currently authenticated user) has administration rights on the current wiki.
[中]检查上下文中的当前用户(当前经过身份验证的用户)是否对当前wiki具有管理权限。

代码示例

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

/**
 * Check if the current user has administration rights on the current wiki.
 * 
 * @return <code>true</code> if the current user has the <code>admin</code> right or <code>false</code> otherwise.
 */
public boolean hasAdminRights()
{
  com.xpn.xwiki.XWiki xwiki = this.context.getWiki();
  return xwiki.getRightService().hasAdminRights(this.context);
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

/**
 * Indicate of the user has amin rights on the farm, i.e. that he has admin rights on the main wiki.
 * 
 * @param context the XWiki context
 * @return true if the current user is farm admin
 */
private boolean isFarmAdmin(XWikiContext context)
{
  String wiki = context.getDatabase();
  try {
    context.setDatabase(context.getMainXWiki());
    return context.getWiki().getRightService().hasAdminRights(context);
  } finally {
    context.setDatabase(wiki);
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-gwt-api

protected User newUser(User user, XWikiDocument xdoc, XWikiContext context) throws XWikiGWTException
{
  newDocument(user, xdoc, context);
  user.setFirstName(xdoc.getStringValue("XWiki.XWikiUsers", "first_name"));
  user.setLastName(xdoc.getStringValue("XWiki.XWikiUsers", "last_name"));
  user.setEmail(xdoc.getStringValue("XWiki.XWikiUsers", "email"));
  XWiki xwiki = context.getWiki();
  user.setAdmin(xwiki.getRightService().hasAdminRights(context));
  return user;
}

代码示例来源:origin: com.avane.xwiki.products/xwiki-plugin-chronopolys

public boolean isAdmin(XWikiContext context) throws XWikiException
{
  return context.getWiki().getUser(context.getLocalUser(), context)
    .isUserInGroup("ChronoAdmin.AdminGroup") ||
    context.getWiki().getUser(context.getLocalUser(), context)
      .isUserInGroup(context.getDatabase() + ":ChronoAdmin.AdminGroup") ||
    context.getWiki().getRightService().hasAdminRights(context);
}

代码示例来源:origin: com.avane.xwiki.products/xwiki-plugin-chronopolys

public boolean isManager(XWikiContext context) throws XWikiException
{
  return context.getWiki().getUser(context.getLocalUser(), context)
    .isUserInGroup("ChronoAdmin.ManagerGroup") ||
    context.getWiki().getUser(context.getLocalUser(), context)
      .isUserInGroup(context.getDatabase() + ":ChronoAdmin.ManagerGroup") ||
    context.getWiki().getRightService().hasAdminRights(context);
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

String[] pages = request.getParameterValues("pages");
if (!context.getWiki().getRightService().hasAdminRights(context)) {
  context.put("message", "needadminrights");
  return "exception";

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

if ((creator != null) && (!creator.equals(getCreator()))) {
  if ((getCreator().equals(context.getUser()))
    || (context.getWiki().getRightService().hasAdminRights(context))) {
    setCreator(creator);

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

boolean isBackup = ((pages == null) || (pages.length == 0));
if (!context.getWiki().getRightService().hasAdminRights(context)) {
  context.put("message", "needadminrights");
  return "exception";

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

public int install(XWikiContext context) throws XWikiException
  boolean isAdmin = context.getWiki().getRightService().hasAdminRights(context);

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com