Search in sources :

Example 1 with PlatformInfo

use of org.apache.syncope.common.lib.info.PlatformInfo in project syncope by apache.

the class SyncopeLogic method platform.

@PreAuthorize("isAuthenticated()")
public PlatformInfo platform() {
    synchronized (MONITOR) {
        if (PLATFORM_INFO == null) {
            PLATFORM_INFO = new PlatformInfo();
            PLATFORM_INFO.setVersion(version);
            PLATFORM_INFO.setBuildNumber(buildNumber);
            if (bundleManager.getLocations() != null) {
                PLATFORM_INFO.getConnIdLocations().addAll(bundleManager.getLocations().stream().map(URI::toASCIIString).collect(Collectors.toList()));
            }
            PLATFORM_INFO.setPropagationTaskExecutor(AopUtils.getTargetClass(propagationTaskExecutor).getName());
            PLATFORM_INFO.setAnyObjectWorkflowAdapter(AopUtils.getTargetClass(awfAdapter).getName());
            PLATFORM_INFO.setUserWorkflowAdapter(AopUtils.getTargetClass(uwfAdapter).getName());
            PLATFORM_INFO.setGroupWorkflowAdapter(AopUtils.getTargetClass(gwfAdapter).getName());
            PLATFORM_INFO.setAnyObjectProvisioningManager(AopUtils.getTargetClass(aProvisioningManager).getName());
            PLATFORM_INFO.setUserProvisioningManager(AopUtils.getTargetClass(uProvisioningManager).getName());
            PLATFORM_INFO.setGroupProvisioningManager(AopUtils.getTargetClass(gProvisioningManager).getName());
            PLATFORM_INFO.setVirAttrCache(AopUtils.getTargetClass(virAttrCache).getName());
            PLATFORM_INFO.setPasswordGenerator(AopUtils.getTargetClass(passwordGenerator).getName());
            PLATFORM_INFO.setAnySearchDAO(AopUtils.getTargetClass(anySearchDAO).getName());
            Arrays.stream(ImplementationType.values()).forEach(type -> {
                JavaImplInfo javaImplInfo = new JavaImplInfo();
                javaImplInfo.setType(type);
                javaImplInfo.getClasses().addAll(implLookup.getClassNames(type));
                PLATFORM_INFO.getJavaImplInfos().add(javaImplInfo);
            });
        }
        PLATFORM_INFO.setSelfRegAllowed(isSelfRegAllowed());
        PLATFORM_INFO.setPwdResetAllowed(isPwdResetAllowed());
        PLATFORM_INFO.setPwdResetRequiringSecurityQuestions(isPwdResetRequiringSecurityQuestions());
        PLATFORM_INFO.getEntitlements().clear();
        PLATFORM_INFO.getEntitlements().addAll(EntitlementsHolder.getInstance().getValues());
        AuthContextUtils.execWithAuthContext(AuthContextUtils.getDomain(), () -> {
            PLATFORM_INFO.getAnyTypes().clear();
            PLATFORM_INFO.getAnyTypes().addAll(anyTypeDAO.findAll().stream().map(Entity::getKey).collect(Collectors.toList()));
            PLATFORM_INFO.getUserClasses().clear();
            PLATFORM_INFO.getUserClasses().addAll(anyTypeDAO.findUser().getClasses().stream().map(Entity::getKey).collect(Collectors.toList()));
            PLATFORM_INFO.getAnyTypeClasses().clear();
            PLATFORM_INFO.getAnyTypeClasses().addAll(anyTypeClassDAO.findAll().stream().map(Entity::getKey).collect(Collectors.toList()));
            PLATFORM_INFO.getResources().clear();
            PLATFORM_INFO.getResources().addAll(resourceDAO.findAll().stream().map(Entity::getKey).collect(Collectors.toList()));
            return null;
        });
    }
    return PLATFORM_INFO;
}
Also used : Entity(org.apache.syncope.core.persistence.api.entity.Entity) JavaImplInfo(org.apache.syncope.common.lib.info.JavaImplInfo) PlatformInfo(org.apache.syncope.common.lib.info.PlatformInfo) URI(java.net.URI) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

URI (java.net.URI)1 JavaImplInfo (org.apache.syncope.common.lib.info.JavaImplInfo)1 PlatformInfo (org.apache.syncope.common.lib.info.PlatformInfo)1 Entity (org.apache.syncope.core.persistence.api.entity.Entity)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1