org.jboss.errai.security.shared.api.Group类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(125)

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

Group介绍

[英]Represents a group a User can be part of for the purpose of access control.

The default implementation of this group in Errai is GroupImpl, but a different implementation may be used so long as:

  • It is Portable.
  • It overrides the Object#equals(Object) method (used to compare groups between User and a secured resource).
  • It overrides the Object#hashCode() method so that equal groups have the same hash. (This is important if you use the default User implementation, which stores groups in a HashSet.)
    [中]表示用户为了访问控制而可以加入的组。
    勘误表中此组的默认实现为GroupImpl,但只要满足以下条件,就可以使用不同的实现:
    *它是便携式的。
    *它覆盖了Object#equals(Object)方法(用于比较用户和安全资源之间的组)。
    *它重写对象#hashCode()方法,以便相同的组具有相同的哈希。(如果使用默认用户实现,这一点很重要,默认用户实现将组存储在哈希集中。)

代码示例

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

public boolean hasAnyGroups(String... groupNames) {
 for (Group group : groups) {
  for (String groupName : groupNames) {
   if (groupName.equals(group.getName())) {
    return true;
   }
  }
 }
 return false;
}

代码示例来源:origin: kiegroup/appformer

public void write(Group group,
         String homePerspectiveId,
         Map out) {
  String key = GROUP + "." + group.getName() + "." + HOME;
  out.remove(key);
  if (homePerspectiveId != null) {
    out.put(key,
        homePerspectiveId);
  }
}

代码示例来源:origin: kiegroup/appformer

public void write(Group group,
         int priority,
         Map out) {
  String key = GROUP + "." + group.getName() + "." + PRIORITY;
  out.put(key,
      Integer.toString(priority));
}

代码示例来源:origin: org.uberfire/uberfire-security-management-wildfly-commons

/**
 * WildFly / EAP realms based on properties do not allow groups with empty users. So the groups are created using the method #assignUsers.
 *
 * @param entity The entity to create.
 * @return A runtime instance for a group.
 * @throws SecurityManagementException
 */
@Override
public Group create( Group entity ) throws SecurityManagementException {
  if (entity == null) throw new NullPointerException();
  return new GroupImpl( entity.getName() );
}

代码示例来源:origin: kiegroup/appformer

protected Set<String> getGroupNames() {
  final Set<String> result = new LinkedHashSet<String>(user.getGroups().size());
  for (final Group group : user.getGroups()) {
    result.add(group.getName());
  }
  return result;
}

代码示例来源:origin: org.uberfire/uberfire-widgets-security-management

protected Set<String> getGroupNames() {
  final Set<String> result = new LinkedHashSet<String>(user.getGroups().size());
  for (final Group group : user.getGroups()) {
    result.add(group.getName());
  }
  return result;
}

代码示例来源:origin: org.uberfire/uberfire-widgets-security-management

@Override
protected void open(final User user) {
  final Set<Group> userGroups = user.getGroups();
  for (final Group group : userGroups) {
    if (!userSystemManager.getConstrainedGroups().contains(group.getName())) {
      this.entities.add(group);
    }
  }
  super.open(user);
}

代码示例来源:origin: kiegroup/appformer

@Override
protected void open(final User user) {
  final Set<Group> userGroups = user.getGroups();
  for (final Group group : userGroups) {
    if (!userSystemManager.getConstrainedGroups().contains(group.getName())) {
      this.entities.add(group);
    }
  }
  super.open(user);
}

代码示例来源:origin: kiegroup/appformer

@Override
  public Group answer(InvocationOnMock invocationOnMock) throws Throwable {
    String name = (String) invocationOnMock.getArguments()[0];
    Group g = mock(Group.class);
    when(g.getName()).thenReturn(name);
    return g;
  }
}).when(groupManager).get(anyString());

代码示例来源:origin: kiegroup/appformer

@Override
public Group create(Group group) throws SecurityManagementException {
  final String name = group.getName();
  if (isConstrained(name)) {
    throw new IllegalArgumentException("Group with name '" + name + "' cannot be created, " +
                          "as it is a constrained value (it is a role or the admin group");
  }
  final GroupManager serviceImpl = getService();
  return serviceImpl.create(group);
}

代码示例来源:origin: kiegroup/appformer

@Override
  public Group answer(InvocationOnMock invocationOnMock) throws Throwable {
    final String _name = (String) invocationOnMock.getArguments()[0];
    final Group group = mock(Group.class);
    when(group.getName()).thenReturn(_name);
    return group;
  }
}).when(userSystemManager).createGroup(anyString());

代码示例来源:origin: kiegroup/appformer

@Override
  public Group answer(InvocationOnMock invocationOnMock) throws Throwable {
    String name = (String) invocationOnMock.getArguments()[0];
    Group g = mock(Group.class);
    when(g.getName()).thenReturn(name);
    return g;
  }
}).when(groupManager).get(anyString());

代码示例来源:origin: kiegroup/appformer

@Override
public Group update(Group group) throws SecurityManagementException {
  final String name = group.getName();
  if (isConstrained(name)) {
    throw new IllegalArgumentException("Group with name '" + name + "' cannot be updated, " +
                          "as it is a constrained value (it is a role or the admin group");
  }
  final GroupManager serviceImpl = getService();
  return serviceImpl.update(group);
}

代码示例来源:origin: org.uberfire/uberfire-security-management-backend

@Override
  public Group answer(InvocationOnMock invocationOnMock) throws Throwable {
    String name = (String) invocationOnMock.getArguments()[0];
    Group g = mock(Group.class);
    when(g.getName()).thenReturn(name);
    return g;
  }
}).when(groupManager).get(anyString());

代码示例来源:origin: org.uberfire/uberfire-security-management-backend

@Override
  public Group answer(InvocationOnMock invocationOnMock) throws Throwable {
    String name = (String) invocationOnMock.getArguments()[0];
    Group g = mock(Group.class);
    when(g.getName()).thenReturn(name);
    return g;
  }
}).when(groupManager).get(anyString());

代码示例来源:origin: kiegroup/appformer

private List<Group> createTestGroups(String namePrefix,
                     int size) {
    List<Group> groups = new LinkedList<Group>();
    for (int x = 0; x < size; x++) {
      Group group = mock(Group.class);
      when(group.getName()).thenReturn(namePrefix + x);
      groups.add(group);
    }
    return groups;
  }
}

代码示例来源:origin: org.uberfire/uberfire-backend-server

private List<org.jboss.errai.security.shared.api.Group> mockGroups( String... names ) {
    ArrayList<org.jboss.errai.security.shared.api.Group> groups = new ArrayList<org.jboss.errai.security.shared.api.Group>();
    for ( String name : names ) {
      org.jboss.errai.security.shared.api.Group g = mock( org.jboss.errai.security.shared.api.Group.class );
      when( g.getName() ).thenReturn( name );
      groups.add( g );
    }
    return groups;
  }
}

代码示例来源:origin: org.uberfire/uberfire-security-management-backend

private List<Group> createTestGroups(String namePrefix,
                     int size) {
    List<Group> groups = new LinkedList<Group>();
    for (int x = 0; x < size; x++) {
      Group group = mock(Group.class);
      when(group.getName()).thenReturn(namePrefix + x);
      groups.add(group);
    }
    return groups;
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-workbench-client

public List<Menus> getGroups() {
  final Set<Group> groups = identity.getGroups();
  final List<Menus> result = new ArrayList<Menus>(groups.size());
  for (final Group group : groups) {
    result.add(MenuFactory.newSimpleItem(constants.Group() + ": " + group.getName()).endMenu().build());
  }
  return result;
}

代码示例来源:origin: org.uberfire/uberfire-security-management-keycloak

private void assertGroup(Group group,
             String name) {
  assertNotNull(group);
  assertEquals(name,
         group.getName());
}

相关文章

微信公众号

最新文章

更多

Group类方法