Package org.beangle.security.blueprint

Examples of org.beangle.security.blueprint.User


    entityDao.saveOrUpdate(newMembers);
    entityDao.remove(removedMembers);
  }

  protected void editSetting(Entity<?> entity) {
    User user = (User) entity;
    User manager = getUser();
    Collection<GroupMember> members = userService.getGroupMembers(manager,
        GroupMember.Ship.GRANTER);
    Set<GroupMember> userMembers = user.getGroups();
    Map<Group, GroupMember> memberMap = CollectUtils.newHashMap();
    for (GroupMember gm : userMembers) {
View Full Code Here


   * @return
   */
  public String remove() {
    String userIdSeq = get("userIds");
    Long[] userIds = SeqStrUtils.transformToLong(userIdSeq);
    User creator = userService.get(getUserId());
    List<User> toBeRemoved = userService.getUsers(userIds);
    try {
      for (User one : toBeRemoved) {
        // 不能删除自己
        if (!one.getId().equals(getUserId())) {
View Full Code Here

  }

  public String info() throws Exception {
    String loginName = get("loginName");
    if (StringUtils.isNotBlank(loginName)) {
      User user = userService.get(loginName);
      if (null != user) {
        put("user", user);
        return forward();
      } else {
        return null;
View Full Code Here

  public void updateState(Long[] ids, int state) {
    assert (null == ids || ids.length < 1);
    List<User> users = getUsers(ids);
    for (int i = 0; i < users.size(); i++) {
      User cur = users.get(i);
      cur.setStatus(state);
    }
    entityDao.saveOrUpdate(users);
  }
View Full Code Here

  public UserDetail loadDetail(Authentication auth) {
    List<User> users = entityDao.get(User.class, "name", auth.getName());
    if (users.isEmpty()) {
      return null;
    } else {
      User user = users.get(0);
      String hql = "select g.group.name from User u join u.groups as g where u.id=?";
      List<String> groupNames = entityDao.searchHQLQuery(hql, user.getId());
      GrantedAuthorityBean[] authorities = new GrantedAuthorityBean[groupNames.size()];
      int i = 0;
      for (String group : groupNames) {
        authorities[i] = new GrantedAuthorityBean(group);
        i++;
      }
      return new UserToken(user.getId(), user.getName(), user.getFullname(), user
          .getPassword(), entityDao.get(UserCategory.class, user.getDefaultCategory()
          .getId()), user.getStatus() > 0, false, false, false, authorities);
    }
  }
View Full Code Here

  public UserPropertyExtractor(TextResource textResource) {
    super(textResource);
  }

  public Object getPropertyValue(Object target, String property) throws Exception {
    User user = (User) target;
    if ("status".equals(property)) {
      int status = user.getStatus();
      switch (status) {
      case User.ACTIVE:
        return getText("action.activate");
      case User.FREEZE:
        return getText("action.freeze");
      default:
        return "unknown status " + status;
      }
    }
    if ("groups".equals(property)) {
      return getPropertyIn(user.getGroups(), "name");
    } else {
      return super.getPropertyValue(target, property);
    }
  }
View Full Code Here

TOP

Related Classes of org.beangle.security.blueprint.User

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.