Search in sources :

Example 1 with RBACManagerImplementationInformation

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

the class RedbackRuntimeConfigurationServiceTest method rbacmanagersinformations.

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

Example 2 with RBACManagerImplementationInformation

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

the class DefaultRedbackRuntimeConfigurationService method getRbacManagerImplementationInformations.

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

Aggregations

RBACManagerImplementationInformation (org.apache.archiva.rest.api.model.RBACManagerImplementationInformation)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 RBACManager (org.apache.archiva.redback.rbac.RBACManager)1 RedbackRuntimeConfigurationService (org.apache.archiva.rest.api.services.RedbackRuntimeConfigurationService)1 Test (org.junit.Test)1