gpt4 book ai didi

com.xpn.xwiki.user.api.XWikiGroupService类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 16:38:40 27 4
gpt4 key购买 nike

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

XWikiGroupService介绍

[英]Interface giving access to users and groups management.
[中]提供用户和组管理访问权限的界面。

代码示例

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

/**
 * Get all users provided group contains.
 * 
 * @param group the name of the group.
 * @param nb the maximum number of result to return.
 * @param start the index of the first found user to return.
 * @param context the XWiki context.
 * @return the {@link Collection} of {@link String} containing user name.
 * @throws XWikiException error when browsing groups.
 */
public Collection<String> getAllMembersNamesForGroup(String group, int nb, int start, XWikiContext context)
  throws XWikiException
{
  return context.getWiki().getGroupService(context).getAllMembersNamesForGroup(group, nb, start, context);
}

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

/**
 * Get all groups containing provided user.
 * 
 * @param member the name of the member (user or group).
 * @param nb the maximum number of result to return.
 * @param start the index of the first found member to return.
 * @param context the XWiki context.
 * @return the {@link Collection} of {@link String} containing group name.
 * @throws XWikiException error when browsing groups.
 */
public Collection<String> getAllGroupsNamesForMember(String member, int nb, int start, XWikiContext context)
  throws XWikiException
{
  return context.getWiki().getGroupService(context).getAllGroupsNamesForMember(member, nb, start, context);
}

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

/**
 * Return the number of groups containing provided member.
 * 
 * @param member the name of the member (user or group).
 * @param context the XWiki context.
 * @return the number of groups.
 * @throws XWikiException error when getting number of users.
 */
public int countAllGroupsNamesForMember(String member, XWikiContext context) throws XWikiException
{
  return context.getWiki().getGroupService(context).countAllGroupsNamesForMember(member, context);
}

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

/**
 * Get the number of users or groups in the current wiki.
 * 
 * @param user indicate if methods search for users or groups.
 * @param matchFields the field to math with values. It is a table of table with :
 *            <ul>
 *            <li>fiedname : the name of the field</li>
 *            <li>fieldtype : for example StringProperty. If null the field is considered as document field</li>
 *            <li>pattern matching : based on HQL "like" command</li>
 *            </ul>
 * @param context the XWiki context.
 * @return the number of groups in the current wiki.
 * @throws XWikiException error when getting number of users or groups.
 */
public int countAllLocalUsersOrGroups(boolean user, Object[][] matchFields, XWikiContext context)
  throws XWikiException
{
  if (user) {
    return context.getWiki().getGroupService(context).countAllMatchedUsers(matchFields, context);
  } else {
    return context.getWiki().getGroupService(context).countAllMatchedGroups(matchFields, context);
  }
}

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

groupService.getAllGroupsReferencesForMember(userOrGroupDocumentReference, 0, 0, context);

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

protected void addUserToGroup(String userName, String groupName, XWikiContext context) throws XWikiException
{
  BaseClass groupClass = getGroupClass(context);
  XWikiDocument groupDoc = getDocument(groupName, context);
  BaseObject memberObject = groupDoc.newXObject(
    this.localReferenceEntityReferenceSerializer.serialize(groupClass.getDocumentReference()), context);
  memberObject.setStringValue("member", userName);
  if (groupDoc.isNew()) {
    saveDocument(groupDoc, context.getMessageTool().get("core.comment.addedUserToGroup"), context);
  } else {
    // TODO Fix use of deprecated call.
    getHibernateStore().saveXWikiObject(memberObject, context, true);
  }
  try {
    XWikiGroupService gservice = getGroupService(context);
    gservice.addUserToGroup(userName, context.getDatabase(), groupName, context);
  } catch (Exception e) {
    LOG.error("Failed to update group service cache", e);
  }
}

代码示例来源:origin: phenotips/phenotips

groupService.getAllGroupsReferencesForMember(currentItem, 0, 0, context);
groups.removeAll(processedEntities);
entitiesToCheck.addAll(groups);

代码示例来源: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

context.getWiki().getGroupService(context).getAllMembersNamesForGroup(groupName, 0, 0, context);
groupCache.put(groupName, memberList);

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

context.getWiki().getGroupService(context).getAllGroupsNamesForMember(xwikiUserName, 0, 0, context);

代码示例来源:origin: org.phenotips/patient-access-rules-api

groupService.getAllGroupsReferencesForMember(currentItem, 0, 0, context);
groups.removeAll(processedEntities);
entitiesToCheck.addAll(groups);

代码示例来源:origin: phenotips/phenotips

String groupName = nestedGroups.get(0);
nestedGroups.remove(0);
Collection<String> members = groupService.getAllMembersNamesForGroup(groupName, 0, 0, context);
for (String memberName : members) {
  EntityReference userOrGroup = this.userOrGroupResolver.resolve(memberName);

代码示例来源:origin: org.xwiki.platform/xwiki-platform-ldap-authenticator

context.getWiki().getGroupService(context).getAllGroupsNamesForMember(xwikiUserName, 0, 0, context);

代码示例来源:origin: org.xwiki.platform/xwiki-platform-security-bridge

while (groupReferences.addAll(groupService.getAllGroupsReferencesForMember(userOrGroupDocumentReference,
  nb, i * nb, xwikiContext))) {
  i++;

代码示例来源:origin: org.xwiki.platform/xwiki-platform-security-bridge

Collection<String> memberNames;
do {
  memberNames = groupService.getAllMembersNamesForGroup(groupName, nb, i * nb, xwikiContext);
  for (String member : memberNames) {
    DocumentReference memberRef = userResolver.resolve(member, wikiReference);

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