use of org.apache.ranger.view.RangerServiceDefList in project ranger by apache.
the class RangerServiceDefServiceBase method searchRangerServiceDefs.
public RangerServiceDefList searchRangerServiceDefs(SearchFilter searchFilter) {
RangerServiceDefList retList = new RangerServiceDefList();
int startIndex = searchFilter.getStartIndex();
int pageSize = searchFilter.getMaxRows();
String denyCondition = searchFilter.getParam(SearchFilter.FETCH_DENY_CONDITION);
searchFilter.setStartIndex(0);
searchFilter.setMaxRows(Integer.MAX_VALUE);
boolean isAuditPage = false;
if (searchFilter.getParam("pageSource") != null) {
isAuditPage = true;
}
List<T> xSvcDefList = searchResources(searchFilter, searchFields, sortFields, retList);
List<T> permittedServiceDefs = new ArrayList<T>();
for (T xSvcDef : xSvcDefList) {
if ((bizUtil.hasAccess(xSvcDef, null) || (bizUtil.isAdmin() && isAuditPage)) || ("true".equals(denyCondition))) {
permittedServiceDefs.add(xSvcDef);
}
}
if (!permittedServiceDefs.isEmpty()) {
populatePageList(permittedServiceDefs, startIndex, pageSize, retList);
}
return retList;
}
use of org.apache.ranger.view.RangerServiceDefList in project ranger by apache.
the class ServiceDBStore method getPaginatedServiceDefs.
@Override
public PList<RangerServiceDef> getPaginatedServiceDefs(SearchFilter filter) throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug("==> ServiceDBStore.getPaginatedServiceDefs(" + filter + ")");
}
RangerServiceDefList svcDefList = serviceDefService.searchRangerServiceDefs(filter);
predicateUtil.applyFilter(svcDefList.getServiceDefs(), filter);
if (LOG.isDebugEnabled()) {
LOG.debug("==> ServiceDBStore.getPaginatedServiceDefs(" + filter + ")");
}
return new PList<RangerServiceDef>(svcDefList.getServiceDefs(), svcDefList.getStartIndex(), svcDefList.getPageSize(), svcDefList.getTotalCount(), svcDefList.getResultSize(), svcDefList.getSortType(), svcDefList.getSortBy());
}
Aggregations