Search in sources :

Example 1 with UserManagerImplementationInformation

use of org.apache.archiva.rest.api.model.UserManagerImplementationInformation in project archiva by apache.

the class DefaultRedbackRuntimeConfigurationService method getUserManagerImplementationInformations.

@Override
public List<UserManagerImplementationInformation> getUserManagerImplementationInformations() throws ArchivaRestServiceException {
    Map<String, UserManager> beans = applicationContext.getBeansOfType(UserManager.class);
    if (beans.isEmpty()) {
        return Collections.emptyList();
    }
    List<UserManagerImplementationInformation> informations = new ArrayList<>(beans.size());
    for (Map.Entry<String, UserManager> entry : beans.entrySet()) {
        UserManager userManager = applicationContext.getBean(entry.getKey(), UserManager.class);
        if (userManager.isFinalImplementation()) {
            UserManagerImplementationInformation information = new UserManagerImplementationInformation();
            information.setBeanId(StringUtils.substringAfter(entry.getKey(), "#"));
            information.setDescriptionKey(userManager.getDescriptionKey());
            information.setReadOnly(userManager.isReadOnly());
            informations.add(information);
        }
    }
    return informations;
}
Also used : UserManagerImplementationInformation(org.apache.archiva.rest.api.model.UserManagerImplementationInformation) UserManager(org.apache.archiva.redback.users.UserManager) ArrayList(java.util.ArrayList) Map(java.util.Map)

Example 2 with UserManagerImplementationInformation

use of org.apache.archiva.rest.api.model.UserManagerImplementationInformation in project archiva by apache.

the class RedbackRuntimeConfigurationServiceTest method usermanagersinformations.

@Test
public void usermanagersinformations() throws Exception {
    RedbackRuntimeConfigurationService service = getRedbackRuntimeConfigurationService();
    List<UserManagerImplementationInformation> infos = service.getUserManagerImplementationInformations();
    assertThat(infos).isNotNull().isNotEmpty().contains(new UserManagerImplementationInformation("jpa", null, false));
}
Also used : UserManagerImplementationInformation(org.apache.archiva.rest.api.model.UserManagerImplementationInformation) RedbackRuntimeConfigurationService(org.apache.archiva.rest.api.services.RedbackRuntimeConfigurationService) Test(org.junit.Test)

Aggregations

UserManagerImplementationInformation (org.apache.archiva.rest.api.model.UserManagerImplementationInformation)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 UserManager (org.apache.archiva.redback.users.UserManager)1 RedbackRuntimeConfigurationService (org.apache.archiva.rest.api.services.RedbackRuntimeConfigurationService)1 Test (org.junit.Test)1