Access to internal API in 4.7.x

A while ago I had a support case about copying a complete site in Enonic CMS with content and all. The hard part was publising content back to the new site. This could be done the following way:

  • Create a controller plugin with admin access
  • Cast a certain class to get access to internal API for publising content

Does anyone from Enonic remember how to do this? I can’t find the information anymore

Found an old link to the old support system :smile:

 final InternalClient internalClient = (InternalClient) client;
        this.adminService = internalClient.getService( AdminService.class );
        this.adminEngine = internalClient.getService( AdminEngine.class );
        this.securityService = internalClient.getService( SecurityService.class );
        this.categoryService = internalClient.getService( CategoryService.class );
        this.securityHandler = internalClient.getService( SecurityHandler.class );
        this.menuItemService = internalClient.getService( MenuItemService.class );
1 Like

So you figured it out?

We got it working so we now can publish content from another application.

1 Like

@tommytusj, @tsi Hi, I know this is quite old but we need a similar functionality now. Do you have a more complete example of that configuration, does the context.xml include anything special?