Search in sources :

Example 1 with IPortalDataType

use of org.apereo.portal.io.xml.IPortalDataType in project uPortal by Jasig.

the class PortalDataTypeTargetProviderImpl method init.

@PostConstruct
public void init() {
    Iterable<IPortalDataType> dataTypes = portalDataHandlerService.getExportPortalDataTypes();
    for (IPortalDataType type : dataTypes) {
        final String typeId = type.getTypeId();
        targetMap.put(typeId, new PermissionTargetImpl(typeId, typeId, IPermissionTarget.TargetType.DATA_TYPE));
    }
}
Also used : IPortalDataType(org.apereo.portal.io.xml.IPortalDataType) PostConstruct(javax.annotation.PostConstruct)

Example 2 with IPortalDataType

use of org.apereo.portal.io.xml.IPortalDataType in project uPortal by Jasig.

the class ImportExportPortletController method getAllowedTypes.

/**
     * Return a list of all permitted import/export types for the given permission and the current
     * user.
     *
     * @param request
     * @param activityName
     * @return
     */
protected List<IPortalDataType> getAllowedTypes(PortletRequest request, String activityName, Iterable<IPortalDataType> dataTypes) {
    // get the authorization principal representing the current user
    final HttpServletRequest httpServletRequest = this.portalRequestUtils.getPortletHttpRequest(request);
    final IPerson person = personManager.getPerson(httpServletRequest);
    final EntityIdentifier ei = person.getEntityIdentifier();
    final IAuthorizationPrincipal ap = AuthorizationService.instance().newPrincipal(ei.getKey(), ei.getType());
    // filter the list of configured import/export types by user permission
    final List<IPortalDataType> results = new ArrayList<IPortalDataType>();
    for (IPortalDataType type : dataTypes) {
        final String typeId = type.getTypeId();
        if (ap.hasPermission(IPermission.PORTAL_SYSTEM, activityName, typeId)) {
            results.add(type);
        }
    }
    return results;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) IPerson(org.apereo.portal.security.IPerson) IPortalDataType(org.apereo.portal.io.xml.IPortalDataType) IAuthorizationPrincipal(org.apereo.portal.security.IAuthorizationPrincipal) ArrayList(java.util.ArrayList) EntityIdentifier(org.apereo.portal.EntityIdentifier)

Example 3 with IPortalDataType

use of org.apereo.portal.io.xml.IPortalDataType in project uPortal by Jasig.

the class TemplateDataTenantOperationsListener method setDataTypeImportOrder.

/** Order in which data types should be imported. */
@javax.annotation.Resource(name = "dataTypeImportOrder")
public void setDataTypeImportOrder(List<IPortalDataType> dataTypeImportOrder) {
    final ArrayList<PortalDataKey> dataKeyImportOrder = new ArrayList<PortalDataKey>(dataTypeImportOrder.size() * 2);
    for (final IPortalDataType portalDataType : dataTypeImportOrder) {
        final List<PortalDataKey> supportedDataKeys = portalDataType.getDataKeyImportOrder();
        for (final PortalDataKey portalDataKey : supportedDataKeys) {
            /*
                 * Special Handling:  Need to prevent some keys from entering our
                 * sorted collection because they attempt to import both a group
                 * part and the membership parts of a group (either local or PAGS)
                 * in one go.  We import several entities at once, so it's important
                 * to do these in 2 phases.
                 */
            if (!KEYS_TO_IGNORE.contains(portalDataKey)) {
                dataKeyImportOrder.add(portalDataKey);
            }
        }
    }
    dataKeyImportOrder.trimToSize();
    this.dataKeyImportOrder = Collections.unmodifiableList(dataKeyImportOrder);
}
Also used : IPortalDataType(org.apereo.portal.io.xml.IPortalDataType) ArrayList(java.util.ArrayList) PortalDataKey(org.apereo.portal.io.xml.PortalDataKey)

Aggregations

IPortalDataType (org.apereo.portal.io.xml.IPortalDataType)3 ArrayList (java.util.ArrayList)2 PostConstruct (javax.annotation.PostConstruct)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 EntityIdentifier (org.apereo.portal.EntityIdentifier)1 PortalDataKey (org.apereo.portal.io.xml.PortalDataKey)1 IAuthorizationPrincipal (org.apereo.portal.security.IAuthorizationPrincipal)1 IPerson (org.apereo.portal.security.IPerson)1