Package org.beangle.ems.security

Examples of org.beangle.ems.security.GroupMember


    Set<GroupMember> newMembers = CollectUtils.newHashSet();
    Set<GroupMember> removedMembers = CollectUtils.newHashSet();
    User manager = entityDao.get(User.class, getUserId());
    Collection<GroupMember> members = userService.getGroupMembers(manager, GroupMember.Ship.GRANTER);
    for (GroupMember member : members) {
      GroupMember myMember = memberMap.get(member.getGroup());
      boolean isMember = getBool("member" + member.getGroup().getId());
      boolean isGranter = getBool("granter" + member.getGroup().getId());
      boolean isManager = getBool("manager" + member.getGroup().getId());
      if (!isMember && !isGranter && !isManager) {
        if (null != myMember) {
          user.getGroups().remove(myMember);
          removedMembers.add(myMember);
        }
      } else {
        if (null == myMember) {
          myMember = new GroupMemberBean(member.getGroup(), user, null);
        }
        myMember.setUpdatedAt(new Date());
        myMember.setMember(isMember);
        myMember.setGranter(isGranter);
        myMember.setManager(isManager);
        newMembers.add(myMember);
      }
    }
    entityDao.execute(Operation.saveOrUpdate(newMembers).remove(removedMembers));
  }
View Full Code Here


    Set<GroupMember> newMembers = CollectUtils.newHashSet();
    Set<GroupMember> removedMembers = CollectUtils.newHashSet();
    User manager = entityDao.get(User.class, getUserId());
    Collection<GroupMember> members = userService.getGroupMembers(manager, GroupMember.Ship.GRANTER);
    for (GroupMember member : members) {
      GroupMember myMember = memberMap.get(member.getGroup());
      boolean isMember = getBool("member" + member.getGroup().getId());
      boolean isGranter = getBool("granter" + member.getGroup().getId());
      boolean isManager = getBool("manager" + member.getGroup().getId());
      if (!isMember && !isGranter && !isManager) {
        if (null != myMember) {
          user.getMembers().remove(myMember);
          removedMembers.add(myMember);
        }
      } else {
        if (null == myMember) {
          myMember = new GroupMemberBean(member.getGroup(), user, null);
        }
        myMember.setUpdatedAt(new Date());
        myMember.setMember(isMember);
        myMember.setGranter(isGranter);
        myMember.setManager(isManager);
        newMembers.add(myMember);
      }
    }
    entityDao.execute(Operation.saveOrUpdate(newMembers).remove(removedMembers));
  }
View Full Code Here

    Set<GroupMember> newMembers = CollectUtils.newHashSet();
    Set<GroupMember> removedMembers = CollectUtils.newHashSet();
    User manager = entityDao.get(User.class, getUserId());
    Collection<GroupMember> members = userService.getGroupMembers(manager, GroupMember.Ship.GRANTER);
    for (GroupMember member : members) {
      GroupMember myMember = memberMap.get(member.getGroup());
      boolean isMember = getBool("member" + member.getGroup().getId());
      boolean isGranter = getBool("granter" + member.getGroup().getId());
      boolean isManager = getBool("manager" + member.getGroup().getId());
      if (!isMember && !isGranter && !isManager) {
        if (null != myMember) {
          user.getMembers().remove(myMember);
          removedMembers.add(myMember);
        }
      } else {
        if (null == myMember) {
          myMember = new GroupMemberBean(member.getGroup(), user, null);
        }
        myMember.setUpdatedAt(new Date());
        myMember.setMember(isMember);
        myMember.setGranter(isGranter);
        myMember.setManager(isManager);
        newMembers.add(myMember);
      }
    }
    entityDao.execute(Operation.saveOrUpdate(newMembers).remove(removedMembers));
  }
View Full Code Here

TOP

Related Classes of org.beangle.ems.security.GroupMember

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.