Search in sources :

Example 56 with IPortletDefinition

use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.

the class PortletExecutionManager method postExecution.

@Override
public void postExecution(HttpServletRequest request, HttpServletResponse response, IPortletExecutionContext context, Exception e) {
    final IPortletWindowId portletWindowId = context.getPortletWindowId();
    final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
    final IPortletEntity portletEntity = portletWindow.getPortletEntity();
    final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
    final IPortletDescriptorKey portletDescriptorKey = portletDefinition.getPortletDescriptorKey();
    final AtomicInteger counter = this.executionCount.get(portletDescriptorKey);
    counter.incrementAndGet();
}
Also used : IPortletEntity(org.apereo.portal.portlet.om.IPortletEntity) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IPortletDescriptorKey(org.apereo.portal.portlet.om.IPortletDescriptorKey) IPortletWindowId(org.apereo.portal.portlet.om.IPortletWindowId) IPortletWindow(org.apereo.portal.portlet.om.IPortletWindow) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Example 57 with IPortletDefinition

use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.

the class PortletExecutionManager method getPortletRenderTimeout.

protected long getPortletRenderTimeout(IPortletWindowId portletWindowId, HttpServletRequest request) {
    if (this.ignoreTimeouts) {
        return DEBUG_TIMEOUT;
    }
    final IPortletDefinition portletDefinition = getPortletDefinition(portletWindowId, request);
    final Integer renderTimeout = portletDefinition.getRenderTimeout();
    if (renderTimeout != null) {
        return getModifiedTimeout(portletDefinition, request, renderTimeout);
    }
    return getModifiedTimeout(portletDefinition, request, portletDefinition.getTimeout());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Example 58 with IPortletDefinition

use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.

the class PortletExecutionManager method getPortletActionTimeout.

protected long getPortletActionTimeout(IPortletWindowId portletWindowId, HttpServletRequest request) {
    if (this.ignoreTimeouts) {
        return DEBUG_TIMEOUT;
    }
    final IPortletDefinition portletDefinition = getPortletDefinition(portletWindowId, request);
    final Integer actionTimeout = portletDefinition.getActionTimeout();
    if (actionTimeout != null) {
        return getModifiedTimeout(portletDefinition, request, actionTimeout);
    }
    return getModifiedTimeout(portletDefinition, request, portletDefinition.getTimeout());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Example 59 with IPortletDefinition

use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.

the class AbstractPermissionsController method isAuthorized.

/*
     * Protected API.
     */
protected final boolean isAuthorized(HttpServletRequest req) throws Exception {
    /*
         * This is sensitive data;  we must verify that the user
         * has the appropriate level of access to see it...
         */
    // STEP (1):  Is there an IPerson?
    final IPerson person = personManager.getPerson((HttpServletRequest) req);
    if (person != null) {
        // STEP (2):  Is the person authenticated?
        final ISecurityContext securityContext = person.getSecurityContext();
        if (securityContext != null && securityContext.isAuthenticated()) {
            // STEP (3):  Does this user have SUBSCRIBE permission for permissionsAdminChannel?
            IAuthorizationPrincipal principal = authorizationService.newPrincipal((String) person.getAttribute(IPerson.USERNAME), IPerson.class);
            final IPortletDefinition permissionsAdminPortlet = portletDefinitionRegistry.getPortletDefinitionByFname(PERMISSIONS_ADMIN_PORTLET_FNAME);
            if (permissionsAdminPortlet == null) {
                return false;
            }
            final String portletId = permissionsAdminPortlet.getPortletDefinitionId().getStringId();
            if (authorizationService.canPrincipalSubscribe(principal, portletId)) {
                return true;
            }
        }
    }
    return false;
}
Also used : IPerson(org.apereo.portal.security.IPerson) IAuthorizationPrincipal(org.apereo.portal.security.IAuthorizationPrincipal) ISecurityContext(org.apereo.portal.security.ISecurityContext) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Example 60 with IPortletDefinition

use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.

the class RenderOnWebFlagSet method apply.

@Override
public boolean apply(final HttpServletRequest request) {
    try {
        final IPortletDefinition portletDefinition = utils.getPortletDefinitionFromServletRequest(request);
        Iterator<IPortletPreference> iterator = portletDefinition.getPortletPreferences().iterator();
        while (iterator.hasNext()) {
            IPortletPreference cur = iterator.next();
            if ("renderOnWeb".equalsIgnoreCase(cur.getName())) {
                return cur.getValues() != null && cur.getValues().length == 1 && Boolean.parseBoolean(cur.getValues()[0]);
            }
        }
    } catch (Exception e) {
        logger.error("Failed to process renderOnWeb check for redirect during pipeline. Failing gracefully by returning false.", e);
    }
    return false;
}
Also used : IPortletPreference(org.apereo.portal.portlet.om.IPortletPreference) IPortletDefinition(org.apereo.portal.portlet.om.IPortletDefinition)

Aggregations

IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)109 IPortletEntity (org.apereo.portal.portlet.om.IPortletEntity)24 IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)22 IAuthorizationPrincipal (org.apereo.portal.security.IAuthorizationPrincipal)17 ArrayList (java.util.ArrayList)16 IPortletDefinitionId (org.apereo.portal.portlet.om.IPortletDefinitionId)14 HashSet (java.util.HashSet)13 IPerson (org.apereo.portal.security.IPerson)13 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)13 PortletCategory (org.apereo.portal.portlet.om.PortletCategory)12 EntityIdentifier (org.apereo.portal.EntityIdentifier)11 IUserLayoutManager (org.apereo.portal.layout.IUserLayoutManager)9 HashMap (java.util.HashMap)8 IPortletWindowId (org.apereo.portal.portlet.om.IPortletWindowId)8 IPortletDefinitionParameter (org.apereo.portal.portlet.om.IPortletDefinitionParameter)7 IPortletPreference (org.apereo.portal.portlet.om.IPortletPreference)7 IUserInstance (org.apereo.portal.user.IUserInstance)7 Locale (java.util.Locale)6 HttpServletRequest (javax.servlet.http.HttpServletRequest)6 PortletDefinition (org.apache.pluto.container.om.portlet.PortletDefinition)6