Search in sources :

Example 1 with IContentManager

use of com.agiletec.plugins.jacms.aps.system.services.content.IContentManager in project entando-core by entando.

the class ContentInfoTag method extractModelId.

private Object extractModelId(PublicContentAuthorizationInfo authInfo, RequestContext reqCtx) {
    Widget widget = (Widget) reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
    ApsProperties showletConfig = widget.getConfig();
    String modelId = (String) showletConfig.get("modelId");
    if (null == modelId) {
        modelId = reqCtx.getRequest().getParameter("modelId");
    }
    if (null == modelId) {
        IContentManager contentManager = (IContentManager) ApsWebApplicationUtils.getBean(JacmsSystemConstants.CONTENT_MANAGER, this.pageContext);
        modelId = contentManager.getDefaultModel(authInfo.getContentId());
    }
    return modelId;
}
Also used : IContentManager(com.agiletec.plugins.jacms.aps.system.services.content.IContentManager) Widget(com.agiletec.aps.system.services.page.Widget) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 2 with IContentManager

use of com.agiletec.plugins.jacms.aps.system.services.content.IContentManager in project entando-core by entando.

the class TestApplicationContext method testGetServices.

public void testGetServices() {
    IResourceManager resourceManager = (IResourceManager) this.getService(JacmsSystemConstants.RESOURCE_MANAGER);
    assertNotNull(resourceManager);
    IContentManager contentManager = (IContentManager) this.getService(JacmsSystemConstants.CONTENT_MANAGER);
    assertNotNull(contentManager);
    IContentModelManager contentModelManager = (IContentModelManager) this.getService(JacmsSystemConstants.CONTENT_MODEL_MANAGER);
    assertNotNull(contentModelManager);
    IContentRenderer contentRenderer = (IContentRenderer) this.getService(JacmsSystemConstants.CONTENT_RENDERER_MANAGER);
    assertNotNull(contentRenderer);
    IContentDispenser contentDispenser = (IContentDispenser) this.getService(JacmsSystemConstants.CONTENT_DISPENSER_MANAGER);
    assertNotNull(contentDispenser);
    ICmsSearchEngineManager searchEngineManager = (ICmsSearchEngineManager) this.getService(JacmsSystemConstants.SEARCH_ENGINE_MANAGER);
    assertNotNull(searchEngineManager);
    ILinkResolverManager linkResolver = (ILinkResolverManager) this.getService(JacmsSystemConstants.LINK_RESOLVER_MANAGER);
    assertNotNull(linkResolver);
    IContentPageMapperManager contentPageMapper = (IContentPageMapperManager) this.getService(JacmsSystemConstants.CONTENT_PAGE_MAPPER_MANAGER);
    assertNotNull(contentPageMapper);
}
Also used : IContentDispenser(com.agiletec.plugins.jacms.aps.system.services.dispenser.IContentDispenser) ICmsSearchEngineManager(com.agiletec.plugins.jacms.aps.system.services.searchengine.ICmsSearchEngineManager) IContentRenderer(com.agiletec.plugins.jacms.aps.system.services.renderer.IContentRenderer) IContentManager(com.agiletec.plugins.jacms.aps.system.services.content.IContentManager) IResourceManager(com.agiletec.plugins.jacms.aps.system.services.resource.IResourceManager) ILinkResolverManager(com.agiletec.plugins.jacms.aps.system.services.linkresolver.ILinkResolverManager) IContentPageMapperManager(com.agiletec.plugins.jacms.aps.system.services.contentpagemapper.IContentPageMapperManager) IContentModelManager(com.agiletec.plugins.jacms.aps.system.services.contentmodel.IContentModelManager)

Example 3 with IContentManager

use of com.agiletec.plugins.jacms.aps.system.services.content.IContentManager in project entando-core by entando.

the class TestCmsApplicationContext method testGetCmsServices.

public void testGetCmsServices() throws Throwable {
    try {
        IResourceManager resourceManager = (IResourceManager) this.getService(JacmsSystemConstants.RESOURCE_MANAGER);
        assertNotNull(resourceManager);
        IContentManager contentManager = (IContentManager) this.getService(JacmsSystemConstants.CONTENT_MANAGER);
        assertNotNull(contentManager);
        ICategoryManager categoryManager = (ICategoryManager) this.getService(SystemConstants.CATEGORY_MANAGER);
        assertNotNull(categoryManager);
        IContentModelManager contentModelManager = (IContentModelManager) this.getService(JacmsSystemConstants.CONTENT_MODEL_MANAGER);
        assertNotNull(contentModelManager);
        IContentRenderer contentRenderer = (IContentRenderer) this.getService(JacmsSystemConstants.CONTENT_RENDERER_MANAGER);
        assertNotNull(contentRenderer);
        IContentDispenser contentDispenser = (IContentDispenser) this.getService(JacmsSystemConstants.CONTENT_DISPENSER_MANAGER);
        assertNotNull(contentDispenser);
        ICmsSearchEngineManager searchEngineManager = (ICmsSearchEngineManager) this.getService(JacmsSystemConstants.SEARCH_ENGINE_MANAGER);
        assertNotNull(searchEngineManager);
        ILinkResolverManager linkResolver = (ILinkResolverManager) this.getService(JacmsSystemConstants.LINK_RESOLVER_MANAGER);
        assertNotNull(linkResolver);
        IContentPageMapperManager contentPageMapper = (IContentPageMapperManager) this.getService(JacmsSystemConstants.CONTENT_PAGE_MAPPER_MANAGER);
        assertNotNull(contentPageMapper);
    } catch (Throwable t) {
        throw t;
    }
}
Also used : IContentDispenser(com.agiletec.plugins.jacms.aps.system.services.dispenser.IContentDispenser) ICmsSearchEngineManager(com.agiletec.plugins.jacms.aps.system.services.searchengine.ICmsSearchEngineManager) IContentRenderer(com.agiletec.plugins.jacms.aps.system.services.renderer.IContentRenderer) IContentManager(com.agiletec.plugins.jacms.aps.system.services.content.IContentManager) IResourceManager(com.agiletec.plugins.jacms.aps.system.services.resource.IResourceManager) ILinkResolverManager(com.agiletec.plugins.jacms.aps.system.services.linkresolver.ILinkResolverManager) IContentPageMapperManager(com.agiletec.plugins.jacms.aps.system.services.contentpagemapper.IContentPageMapperManager) ICategoryManager(com.agiletec.aps.system.services.category.ICategoryManager) IContentModelManager(com.agiletec.plugins.jacms.aps.system.services.contentmodel.IContentModelManager)

Example 4 with IContentManager

use of com.agiletec.plugins.jacms.aps.system.services.content.IContentManager in project entando-core by entando.

the class TestContentAuthorization method testCheckCustomerUser.

public void testCheckCustomerUser() throws Throwable {
    UserDetails extractedUser = this.getUser("pageManagerCustomers");
    assertNotNull(extractedUser);
    assertEquals("pageManagerCustomers", extractedUser.getUsername());
    assertEquals(1, extractedUser.getAuthorizations().size());
    IContentManager contentManager = (IContentManager) this.getService(JacmsSystemConstants.CONTENT_MANAGER);
    Content content = contentManager.loadContent("ART111", true);
    boolean checkContent = this._authorizationManager.isAuth(extractedUser, content);
    assertTrue(checkContent);
    content = contentManager.loadContent("EVN25", true);
    checkContent = this._authorizationManager.isAuth(extractedUser, content);
    assertTrue(checkContent);
    content = contentManager.loadContent("EVN41", true);
    checkContent = this._authorizationManager.isAuth(extractedUser, content);
    assertFalse(checkContent);
}
Also used : UserDetails(com.agiletec.aps.system.services.user.UserDetails) IContentManager(com.agiletec.plugins.jacms.aps.system.services.content.IContentManager) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content)

Example 5 with IContentManager

use of com.agiletec.plugins.jacms.aps.system.services.content.IContentManager in project entando-core by entando.

the class TestContentAuthorization method testCheckNewUser.

/*
     * This test is fully inherited from the original TestAuthorizationManager in jAPS2 (2.0.6)
     */
public void testCheckNewUser() throws Throwable {
    String username = "UserForTest";
    String password = "PasswordForTest";
    this.addUserForTest(username, password);
    UserDetails extractedUser = null;
    try {
        extractedUser = this.getUser(username, password);
        assertEquals(username, extractedUser.getUsername());
        assertNotNull(extractedUser);
        assertEquals(1, extractedUser.getAuthorizations().size());
        Group group = this._groupManager.getGroup("coach");
        boolean checkGroup = this._authorizationManager.isAuth(extractedUser, group);
        assertFalse(checkGroup);
        group = this._groupManager.getGroup(Group.FREE_GROUP_NAME);
        checkGroup = this._authorizationManager.isAuth(extractedUser, group);
        assertTrue(checkGroup);
        boolean checkPermission = this._authorizationManager.isAuthOnPermission(extractedUser, Permission.SUPERVISOR);
        assertFalse(checkPermission);
        checkPermission = this._authorizationManager.isAuthOnPermission(extractedUser, Permission.SUPERUSER);
        assertFalse(checkPermission);
        checkPermission = this._authorizationManager.isAuthOnPermission(extractedUser, Permission.BACKOFFICE);
        assertTrue(checkPermission);
        checkPermission = this._authorizationManager.isAuthOnPermission(extractedUser, "editContents");
        assertTrue(checkPermission);
        IContentManager contentManager = (IContentManager) this.getService(JacmsSystemConstants.CONTENT_MANAGER);
        Content content = contentManager.loadContent("ART111", true);
        boolean checkContent = this._authorizationManager.isAuth(extractedUser, content);
        assertFalse(checkContent);
        content = contentManager.loadContent("EVN25", true);
        checkContent = this._authorizationManager.isAuth(extractedUser, content);
        assertTrue(checkContent);
        content = contentManager.loadContent("EVN41", true);
        checkContent = this._authorizationManager.isAuth(extractedUser, content);
        assertFalse(checkContent);
    } catch (Throwable t) {
        throw t;
    } finally {
        if (null != extractedUser) {
            this._userManager.removeUser(extractedUser);
        }
        extractedUser = this._userManager.getUser(username);
        assertNull(extractedUser);
    }
}
Also used : Group(com.agiletec.aps.system.services.group.Group) UserDetails(com.agiletec.aps.system.services.user.UserDetails) IContentManager(com.agiletec.plugins.jacms.aps.system.services.content.IContentManager) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content)

Aggregations

IContentManager (com.agiletec.plugins.jacms.aps.system.services.content.IContentManager)9 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)5 UserDetails (com.agiletec.aps.system.services.user.UserDetails)3 IPage (com.agiletec.aps.system.services.page.IPage)2 IContentModelManager (com.agiletec.plugins.jacms.aps.system.services.contentmodel.IContentModelManager)2 IContentPageMapperManager (com.agiletec.plugins.jacms.aps.system.services.contentpagemapper.IContentPageMapperManager)2 IContentDispenser (com.agiletec.plugins.jacms.aps.system.services.dispenser.IContentDispenser)2 ILinkResolverManager (com.agiletec.plugins.jacms.aps.system.services.linkresolver.ILinkResolverManager)2 IContentRenderer (com.agiletec.plugins.jacms.aps.system.services.renderer.IContentRenderer)2 IResourceManager (com.agiletec.plugins.jacms.aps.system.services.resource.IResourceManager)2 ICmsSearchEngineManager (com.agiletec.plugins.jacms.aps.system.services.searchengine.ICmsSearchEngineManager)2 ArrayList (java.util.ArrayList)2 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)1 ICategoryManager (com.agiletec.aps.system.services.category.ICategoryManager)1 Group (com.agiletec.aps.system.services.group.Group)1 Lang (com.agiletec.aps.system.services.lang.Lang)1 PageMetadata (com.agiletec.aps.system.services.page.PageMetadata)1 PageUtilizer (com.agiletec.aps.system.services.page.PageUtilizer)1 Widget (com.agiletec.aps.system.services.page.Widget)1 ApsProperties (com.agiletec.aps.util.ApsProperties)1