gpt4 book ai didi

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

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

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

XWikiRightService.hasProgrammingRights介绍

[英]Checks if the author of the context document (last editor of the content of the document) has programming rights (used to determine if the protected calls in the script contained in the document should be executed or not).
[中]检查上下文文档的作者(文档内容的最后一个编辑器)是否具有编程权限(用于确定是否应执行文档中包含的脚本中受保护的调用)。

代码示例

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

/**
 * Check if the current document has programming rights, meaning that it was last saved by a user with the
 * programming right globally granted.
 * 
 * @return <tt>true</tt> if the current document has the Programming right or <tt>false</tt> otherwise.
 */
public boolean hasProgrammingRights()
{
  com.xpn.xwiki.XWiki xwiki = this.context.getWiki();
  return xwiki.getRightService().hasProgrammingRights(this.context);
}

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

@GET
  public SearchResults search(@PathParam("wikiName") String wikiName, @PathParam("spaceName") String spaceName,
    @QueryParam("q") String keywords, @QueryParam("scope") List<String> searchScopeStrings,
    @QueryParam("number") @DefaultValue("-1") Integer number) throws QueryException, XWikiException
  {
    SearchResults searchResults = objectFactory.createSearchResults();
    searchResults.setTemplate(String.format("%s?%s",
      UriBuilder.fromUri(uriInfo.getBaseUri()).path(SpaceSearchResource.class).build(wikiName, spaceName)
        .toString(), SEARCH_TEMPLATE_INFO));

    List<SearchScope> searchScopes = parseSearchScopeStrings(searchScopeStrings);

    searchResults.getSearchResults().addAll(
      search(searchScopes, keywords, wikiName, spaceName, Utils.getXWiki(componentManager).getRightService()
        .hasProgrammingRights(Utils.getXWikiContext(componentManager)), number));

    return searchResults;
  }
}

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

@GET
  public SearchResults search(@PathParam("wikiName") String wikiName, @QueryParam("q") String keywords,
    @QueryParam("scope") List<String> searchScopeStrings, @QueryParam("number") @DefaultValue("-1") Integer number)
    throws QueryException, XWikiException
  {
    SearchResults searchResults = objectFactory.createSearchResults();
    searchResults.setTemplate(String.format("%s?%s",
      UriBuilder.fromUri(uriInfo.getBaseUri()).path(WikiSearchResource.class).build(wikiName).toString(),
      SEARCH_TEMPLATE_INFO));

    Utils.getXWikiContext(componentManager).setDatabase(wikiName);

    List<SearchScope> searchScopes = parseSearchScopeStrings(searchScopeStrings);

    searchResults.getSearchResults().addAll(
      search(searchScopes, keywords, wikiName, null, Utils.getXWiki(componentManager).getRightService()
        .hasProgrammingRights(Utils.getXWikiContext(componentManager)), number));

    return searchResults;
  }
}

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

/**
 * {@inheritDoc}
 * 
 * @see org.xwiki.bridge.DocumentAccessBridge#hasProgrammingRights()
 */
public boolean hasProgrammingRights()
{
  XWikiContext xcontext = getContext();
  return xcontext.getWiki().getRightService().hasProgrammingRights(xcontext);
}

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

public XWikiAuthService getAuthService(XWikiContext context)
{
  String authservicepage = getParam("groovy_pagename", context);
  if ((authservicepage == null) || authservicepage.trim().equals("")) {
    if (log.isErrorEnabled())
      log.error("No page specified for auth service implementation");
    return null;
  }
  try {
    XWikiDocument doc = context.getWiki().getDocument(authservicepage, context);
    if (context.getWiki().getRightService().hasProgrammingRights(doc, context))
      return (XWikiAuthService) context.getWiki().parseGroovyFromString(doc.getContent(), context);
    else {
      if (log.isErrorEnabled())
        log.error("Auth service implementation page " + authservicepage
          + " missing programming rights, requires ownership by authorized user.");
      return null;
    }
  } catch (XWikiException e) {
    if (log.isErrorEnabled())
      log.error("Exception while parsing groovy authentication service code", e);
    return null;
  }
}

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

if (!context.getWiki().getRightService().hasProgrammingRights(contextdoc, context)) {
  return content;

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

/**
   * @return the actual value of the property, as a String, Number or List.
   */
  public java.lang.Object getValue()
  {
    // This is evil, any property which happens to be called 'password' will be masked. TODO fix.
    if (element.getName().equals("password")
      && !getXWikiContext().getWiki().getRightService().hasProgrammingRights(
        getXWikiContext())) {
      return null;
    }
    return ((BaseProperty) element).getValue();
  }
}

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

XWikiContext context = getXWikiContext();
XWikiDocument queryDoc = context.getWiki().getDocument(queryPage, context);
if (context.getWiki().getRightService().hasProgrammingRights(queryDoc, context)) {
  if (params != null) {
    XWikiRequestWrapper srw = new XWikiRequestWrapper(context.getRequest());

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

protected void notifyPage(String page, XWikiNotificationRule rule, XWikiDocument doc, String action, XWikiContext context) {
    XWikiActionNotificationInterface notif = null;
    try {
      XWiki xwiki = context.getWiki();
      XWikiDocument pagedoc = xwiki.getDocument(page, context);
      if (xwiki.getRightService().hasProgrammingRights(pagedoc, context)) {
        notif = (XWikiActionNotificationInterface) xwiki.parseGroovyFromString(pagedoc.getContent(), context);
        notif.notify(rule, doc, action, context);
      }
    } catch (Throwable e) {
      Object[] args = { page };
      XWikiException e2 = new XWikiException(XWikiException.MODULE_XWIKI_GROOVY, XWikiException.ERROR_XWIKI_GROOVY_EXECUTION_FAILED, "Error parsing groovy notification for page {0}", e, args);
      if (log.isErrorEnabled())
        log.error(e2.getFullMessage());
    }
  }
}

代码示例来源:origin: com.xpn.xwiki.platform.plugins/xwiki-plugin-scheduler

context.put("sdoc", jobDocument);
if (context.getWiki().getRightService().hasProgrammingRights(context)) {

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

/**
 * Privileged API to retrieve an object instanciated from groovy code in a String Groovy scripts compilation is
 * cached
 * 
 * @param fullname // script containing a Groovy class definition (public class MyClass { ... })
 * @return An object instanciating this class
 * @throws XWikiException
 */
public java.lang.Object parseGroovyFromPage(String fullname) throws XWikiException
{
  XWikiDocument doc = this.xwiki.getDocument(fullname, getXWikiContext());
  if (this.xwiki.getRightService().hasProgrammingRights(doc, getXWikiContext())) {
    return this.xwiki.parseGroovyFromString(doc.getContent(), getXWikiContext());
  }
  return "groovy_missingrights";
}

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

/**
 * Privileged API to retrieve an object instantiated from groovy code in a String, using a classloader including all
 * JAR files located in the passed page as attachments. Note that Groovy scripts compilation is cached
 * 
 * @param script the Groovy class definition string (public class MyClass { ... })
 * @return An object instantiating this class
 * @throws XWikiException
 */
public java.lang.Object parseGroovyFromPage(String script, String jarWikiPage) throws XWikiException
{
  XWikiDocument doc = this.xwiki.getDocument(script, getXWikiContext());
  if (this.xwiki.getRightService().hasProgrammingRights(doc, getXWikiContext())) {
    return this.xwiki.parseGroovyFromString(doc.getContent(), jarWikiPage, getXWikiContext());
  }
  return "groovy_missingrights";
}

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

getXWikiContext().put("sdoc", jobDocument);
if (getXWikiContext().getWiki().getRightService().hasProgrammingRights(getXWikiContext())) {

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