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;
}
Aggregations