Package org.beangle.ems.security.nav

Examples of org.beangle.ems.security.nav.MenuProfile


 
  public String index() {
    User user = entityDao.get(User.class, getUserId());
    Long categoryId = getUserCategoryId();
    put("categoryId", categoryId);
    MenuProfile profile = getMenuProfile(categoryId);
    if (null != profile) {
      put("menus", HierarchyEntityUtil.getRoots(menuService.getMenus(profile, user)));
    } else {
      put("menus", Collections.EMPTY_LIST);
    }
View Full Code Here


    Long menuProfileId = Params.getLong("menuProfileId");
    if (null == menuProfileId && !menuProfiles.isEmpty()) {
      menuProfileId = ((MenuProfile) (menuProfiles.get(0))).getId();
    }
    if (null != menuProfileId) {
      MenuProfile menuProfile = (MenuProfile) entityDao.get(MenuProfile.class, menuProfileId);
      List<Menu> menus = menuService.getMenus(menuProfile, user);
      Set<Resource> resources = CollectUtils.newHashSet(authorityService.getResources(user));
      Map<Group, List<Menu>> groupMenusMap = CollectUtils.newHashMap();

      List<Group> myGroups = userService.getGroups(user, GroupMember.Ship.MEMBER);
View Full Code Here

    put("profiles", entityDao.getAll(MenuProfile.class));
    Menu menu = (Menu) entity;
    List<Menu> folders = CollectUtils.newArrayList();
    OqlBuilder<Resource> builder = OqlBuilder.from(Resource.class, "r");
    if (null != menu.getProfile() && null != menu.getProfile().getId()) {
      MenuProfile profile = entityDao.get(MenuProfile.class, menu.getProfile().getId());
      builder.where("exists(from r.categories as rc where rc=:category)", profile.getCategory());
      // 查找可以作为父节点的菜单
      OqlBuilder<Menu> folderBuilder = OqlBuilder.from(Menu.class, "m");
      folderBuilder.where("m.entry is null and m.profile=:profile", profile);
      folderBuilder.orderBy("m.code");
      folders = entityDao.search(folderBuilder);
View Full Code Here

      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);
    }
    CollectionUtils.filter(menus, new Predicate() {
View Full Code Here

    User user = entityDao.get(User.class, getUserId());
    Long categoryId = getLong("security.categoryId");
    if (null == categoryId) {
      categoryId = getUserCategoryId();
    }
    MenuProfile profile = getMenuProfile(categoryId);
    List<Menu> menus = menuService.getMenus(profile, user);
    List<Menu> menuPath = CollectUtils.newArrayList();
    Long menuId = getLong("menu.id");
    if (null != menuId) {
      Menu menu = entityDao.get(Menu.class, menuId);
View Full Code Here

    query.where("menuProfile.category in(:categories)", categories);
    List<MenuProfile> menuProfiles = entityDao.search(query);
    put("menuProfiles", menuProfiles);

    Long menuProfileId = getLong("menuProfileId");
    MenuProfile menuProfile = null;
    if (null != menuProfileId) {
      menuProfile = entityDao.get(MenuProfile.class, menuProfileId);
      if (!menuProfile.getCategory().equals(ao.getCategory())) {
        menuProfile = (menuProfiles.get(0));
      }
    } else {
      menuProfile = (menuProfiles.get(0));
    }
    if (null != menuProfile) {
      List<Menu> menus = null;
      Collection<Resource> resources = null;
      if (isAdmin()) {
        menus = menuProfile.getMenus();
        resources = entityDao.getAll(Resource.class);
      } else {
        menus = menuService.getMenus(menuProfile, user);
        resources = authorityService.getResources(user);
      }
View Full Code Here

  /**
   * 保存模块级权限
   */
  public String save() {
    Group mao = entityDao.get(Group.class, getLong("group.id"));
    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 {
      mngMenus = CollectUtils.newHashSet(menuService.getMenus(menuProfile, (User) manager));
    }
    for (final Menu m : mngMenus) {
      mngResources.addAll(m.getResources());
    }
    newResources.retainAll(mngResources);
    authorityService.authorize(mao, newResources);
    authorityManager.refreshGroupAuthorities(new GrantedAuthorityBean(mao.getName()));

    Action redirect = Action.to(this).method("edit");
    redirect.param("group.id", mao.getId()).param("menuProfileId", menuProfile.getId());
    String displayFreezen = get("displayFreezen");
    if (null != displayFreezen) {
      redirect.param("displayFreezen", displayFreezen);
    }
    return redirect(redirect, "info.save.success");
View Full Code Here

    Long menuProfileId = Params.getLong("menuProfileId");
    if (null == menuProfileId && !menuProfiles.isEmpty()) {
      menuProfileId = ((MenuProfile) (menuProfiles.get(0))).getId();
    }
    if (null != menuProfileId) {
      MenuProfile menuProfile = (MenuProfile) entityDao.get(MenuProfile.class, menuProfileId);
      List<Menu> menus = menuService.getMenus(menuProfile, user);
      Set<Resource> resources = CollectUtils.newHashSet(authorityService.getResources(user));
      Map<String, Group> groupMap = CollectUtils.newHashMap();
      Map<String, List<Menu>> groupMenusMap = CollectUtils.newHashMap();
View Full Code Here

    put("profiles", entityDao.getAll(MenuProfile.class));
    Menu menu = (Menu) entity;
    List<Menu> folders = CollectUtils.newArrayList();
    OqlBuilder<Resource> builder = OqlBuilder.from(Resource.class, "r");
    if (null != menu.getProfile() && null != menu.getProfile().getId()) {
      MenuProfile profile = entityDao.get(MenuProfile.class, menu.getProfile().getId());
      builder.where("exists(from r.categories as rc where rc=:category)", profile.getCategory());
      // 查找可以作为父节点的菜单
      OqlBuilder<Menu> folderBuilder = OqlBuilder.from(Menu.class, "m");
      folderBuilder.where("m.entry is null and m.profile=:profile", profile);
      folderBuilder.orderBy("m.code");
      folders = entityDao.search(folderBuilder);
View Full Code Here

    query.where("menuProfile.category in(:categories)", categories);
    List<MenuProfile> menuProfiles = entityDao.search(query);
    put("menuProfiles", menuProfiles);

    Long menuProfileId = getLong("menuProfileId");
    MenuProfile menuProfile = null;
    if (null != menuProfileId) {
      menuProfile = entityDao.get(MenuProfile.class, menuProfileId);
      if (!menuProfile.getCategory().equals(ao.getCategory())) {
        menuProfile = (menuProfiles.get(0));
      }
    } else {
      menuProfile = (menuProfiles.get(0));
    }
    if (null != menuProfile) {
      List<Menu> menus = null;
      Collection<Resource> resources = null;
      if (isAdmin()) {
        menus = menuProfile.getMenus();
        resources = entityDao.getAll(Resource.class);
      } else {
        menus = menuService.getMenus(menuProfile, user);
        resources = authorityService.getResources(user);
      }
View Full Code Here

TOP

Related Classes of org.beangle.ems.security.nav.MenuProfile

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.