Search in sources :

Example 36 with CatalogCategory

use of com.emc.storageos.db.client.model.uimodels.CatalogCategory in project coprhd-controller by CoprHD.

the class CatalogCategoryService method filterCategoriesByACLs.

/**
 * filter out the categories which user don't have access to
 *
 * @param categories
 * @return
 */
private List<CatalogCategory> filterCategoriesByACLs(List<CatalogCategory> categories) {
    List<CatalogCategory> filteredCatalogCategories = Lists.newArrayList();
    StorageOSUser storageOSUser = getUserFromContext();
    String username = storageOSUser.getName();
    if (isAdministrator(storageOSUser)) {
        log.debug(username + " has SystemAdmin or TenantAdmin Role, can view all categories.");
        filteredCatalogCategories.addAll(categories);
        return filteredCatalogCategories;
    }
    for (CatalogCategory category : categories) {
        if (hasAccess(storageOSUser, category)) {
            filteredCatalogCategories.add(category);
        }
    }
    return filteredCatalogCategories;
}
Also used : StorageOSUser(com.emc.storageos.security.authentication.StorageOSUser) CatalogCategoryMapper.createNewCatalogCategory(com.emc.sa.api.mapper.CatalogCategoryMapper.createNewCatalogCategory) CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory)

Aggregations

CatalogCategory (com.emc.storageos.db.client.model.uimodels.CatalogCategory)36 NamedURI (com.emc.storageos.db.client.model.NamedURI)12 CatalogCategoryMapper.createNewCatalogCategory (com.emc.sa.api.mapper.CatalogCategoryMapper.createNewCatalogCategory)9 Path (javax.ws.rs.Path)9 BaseModelTest (com.emc.sa.model.BaseModelTest)7 ModelClient (com.emc.sa.model.dao.ModelClient)7 CatalogService (com.emc.storageos.db.client.model.uimodels.CatalogService)7 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)7 URI (java.net.URI)7 Consumes (javax.ws.rs.Consumes)7 Produces (javax.ws.rs.Produces)7 Test (org.junit.Test)7 StorageOSUser (com.emc.storageos.security.authentication.StorageOSUser)6 PUT (javax.ws.rs.PUT)4 CatalogServiceField (com.emc.storageos.db.client.model.uimodels.CatalogServiceField)3 POST (javax.ws.rs.POST)3 CatalogACLInputFilter (com.emc.sa.api.utils.CatalogACLInputFilter)2 WorkflowServiceDescriptor (com.emc.sa.catalog.WorkflowServiceDescriptor)2 ServiceDescriptor (com.emc.sa.descriptor.ServiceDescriptor)2 GET (javax.ws.rs.GET)2