Package org.beangle.ems.security

Examples of org.beangle.ems.security.User


  }

  public String info() throws Exception {
    String name = get("name");
    if (StringUtils.isNotBlank(name)) {
      User user = userService.get(name);
      if (null != user) {
        put("user", user);
        return forward(new Action((Class<?>) null, "dashboard", "&user.id=" + user.getId()));
      } else {
        return null;
      }
    } else {
      return super.info();
View Full Code Here


   * @return
   */
  public String save() {
    Long userId = getLong("user.id");
    if (ValidEntityKeyPredicate.INSTANCE.evaluate(userId)) {
      User user = userService.get(userId);
      User manager = entityDao.get(User.class, getUserId());
      if (userService.isManagedBy(manager, user)) {
        return updateAccount(userId);
      } else {
        return null;
      }
View Full Code Here

  protected String saveAndForward(Entity<?> entity) {
    Group group = (Group) entity;
    if (entityDao.duplicate(Group.class, group.getId(), "name", group.getName())) { return redirect(
        "edit", "error.notUnique"); }
    if (!group.isPersisted()) {
      User creator = userService.get(getUserId());
      userService.createGroup(creator, group);
    } else {
      group.setUpdatedAt(new Date(System.currentTimeMillis()));
      if (!group.isPersisted()) {
        group.setCreatedAt(new Date(System.currentTimeMillis()));
View Full Code Here

   *
   * @return
   */
  public String remove() {
    Long[] groupIds = getEntityIds(getShortName());
    User curUser = userService.get(getUserId());
    userService.removeGroup(curUser, entityDao.get(Group.class, groupIds));
    return redirect("search", "info.remove.success");
  }
View Full Code Here

    } else {
      family = null;
      givenMenu = null;
    }

    User user = entityDao.get(User.class, getUserId());
    Long categoryId = getUserCategoryId();
    MenuProfile profile = getMenuProfile(categoryId);
    List<Menu> menus = Collections.emptyList();
    if (null != profile) {
      menus = menuService.getMenus(profile, user);
View Full Code Here

    put("tops", HierarchyEntityUtil.getRoots(menus));
    return forward();
  }

  public String search() {
    User user = entityDao.get(User.class, getUserId());
    Long categoryId = getLong("security.categoryId");
    if (null == categoryId) {
      categoryId = getUserCategoryId();
    }
    MenuProfile profile = getMenuProfile(categoryId);
View Full Code Here

    Long groupId = getLong("group.id");
    if (null == groupId) {
      groupId = getLong("groupIds");
    }
    Group ao = entityDao.get(Group.class, groupId);
    User user = entityDao.get(User.class, getUserId());
    put("manager", user);
    List<Group> mngGroups = CollectUtils.newArrayList();
    if (isAdmin()) {
      mngGroups = entityDao.getAll(Group.class);
    } else {
      for (GroupMember m : user.getGroups()) {
        if (m.isManager()) mngGroups.add(m.getGroup());
      }
    }
    put("mngGroups", mngGroups);
View Full Code Here

    MenuProfile menuProfile = (MenuProfile) entityDao.get(MenuProfile.class, getLong("menuProfileId"));
    Set<Resource> newResources = CollectUtils.newHashSet(entityDao.get(Resource.class,
        StrUtils.splitToLong(get("resourceId"))));

    // 管理员拥有的菜单权限和系统资源
    User manager = entityDao.get(User.class, getUserId());
    Set<Menu> mngMenus = null;
    Set<Resource> mngResources = CollectUtils.newHashSet();
    if (isAdmin()) {
      mngMenus = CollectUtils.newHashSet(menuProfile.getMenus());
    } else {
View Full Code Here

  public String info() {
    String userName = get("user.name");
    if (StringUtils.isEmpty(userName)) { return null; }
    List<User> users = entityDao.get(User.class, "name", userName);
    if (!users.isEmpty()) {
      User user = users.get(0);
      put("user", StrUtils.concat(userName, "(", user.getFullname(), ")"));
    } else {
      put("user", userName);
    }
    Avatar avatar = avatarBase.getAvatar(userName);
    put("avatar", avatar);
View Full Code Here

  public String info() {
    String userName = get("user.name");
    if (StringUtils.isEmpty(userName)) { return null; }
    List<User> users = entityDao.get(User.class, "name", userName);
    if (!users.isEmpty()) {
      User user = users.get(0);
      put("user", StrUtils.concat(userName, "(", user.getFullname(), ")"));
    } else {
      put("user", userName);
    }
    Avatar avatar = avatarBase.getAvatar(userName);
    put("avatar", avatar);
View Full Code Here

TOP

Related Classes of org.beangle.ems.security.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.