robe-admin/src/main/java/io/robe/admin/resources/MenuResource.java
@RobeService(group = "Menu", description = "Get menu for logged user")
    @Path("user")
    @GET
    @UnitOfWork(readOnly = true, cacheMode = GET, flushMode = FlushMode.MANUAL)
    @CacheControl(noCache = true)
    public List<MenuItem> getUserHierarchicalMenu(@RobeAuth Credentials credentials) {
        Optional<User> user = userDao.findByUsername(credentials.getUsername());
        Set<Permission> permissions = new HashSet<Permission>();

        Role parent = roleDao.findById(user.get().getRoleOid());
        getAllRolePermissions(parent, permissions);
        Set<String> menuOids = new HashSet<String>();

        List<MenuItem> items = convertMenuToMenuItem(menuDao.findHierarchicalMenu());
        items = readMenuHierarchical(items);

        for (Permission permission : permissions) {
            if (permission.getType().equals(Permission.Type.MENU)) {
                menuOids.add(permission.getRestrictedItemOid());
            }
        }
        List<MenuItem> permittedItems = new LinkedList<MenuItem>();

        createMenuWithPermissions(menuOids, items, permittedItems);

        return permittedItems;
    }
@RobeService(group = "Menu", description = "Get menu for logged user")
    @Path("user")
    @GET
    @UnitOfWork(readOnly = true, cacheMode = GET, flushMode = FlushMode.MANUAL)
    @CacheControl(noCache = true)
    public List<MenuItem> getUserHierarchicalMenu(@RobeAuth Credentials credentials) {
        Optional<User> user = userDao.findByUsername(credentials.getUsername());
        Set<Permission> permissions = new HashSet<Permission>();

        Role parent = roleDao.findById(user.get().getRoleOid());
        getAllRolePermissions(parent, permissions);
        Set<String> menuOids = new HashSet<String>();

        List<MenuItem> items = convertMenuToMenuItem(menuDao.findHierarchicalMenu());
        items = readMenuHierarchical(items);

        for (Permission permission : permissions) {
            if (permission.getType().equals(Permission.Type.MENU)) {
                menuOids.add(permission.getRestrictedItemOid());
            }
        }
        List<MenuItem> permittedItems = new LinkedList<MenuItem>();

        createMenuWithPermissions(menuOids, items, permittedItems);

        return permittedItems;
    }
get menu for logged user

@param credentials injected by {@link RobeAuth} annotation for authentication.
@return user {@link MenuItem} as collection