use of de.metas.security.IUserRolePermissions in project metasfresh-webui-api by metasfresh.
the class SqlViewRowIdsOrderedSelectionFactory method extractQueryLimit.
private int extractQueryLimit(final ViewEvaluationCtx viewEvalCtx) {
final UserRolePermissionsKey permissionsKey = viewEvalCtx.getPermissionsKey();
final IUserRolePermissions permissions = userRolePermissionsRepo.getUserRolePermissions(permissionsKey);
return permissions.getConstraint(WindowMaxQueryRecordsConstraint.class).or(WindowMaxQueryRecordsConstraint.DEFAULT).getMaxQueryRecordsPerRole();
}
use of de.metas.security.IUserRolePermissions in project metasfresh-webui-api by metasfresh.
the class ADProcessDescriptorsFactory method streamDocumentRelatedProcesses.
public Stream<WebuiRelatedProcessDescriptor> streamDocumentRelatedProcesses(@NonNull final WebuiPreconditionsContext preconditionsContext, @NonNull final IUserRolePermissions userRolePermissions) {
final String tableName = preconditionsContext.getTableName();
final int adTableId = !Check.isEmpty(tableName) ? adTableDAO.retrieveTableId(tableName) : -1;
final AdWindowId adWindowId = preconditionsContext.getAdWindowId();
final AdTabId adTabId = preconditionsContext.getAdTabId();
final Stream<RelatedProcessDescriptor> relatedProcessDescriptors;
{
final Stream<RelatedProcessDescriptor> tableRelatedProcessDescriptors = adProcessDAO.retrieveRelatedProcessDescriptors(adTableId, adWindowId, adTabId).stream();
final Stream<RelatedProcessDescriptor> additionalRelatedProcessDescriptors = preconditionsContext.getAdditionalRelatedProcessDescriptors().stream();
relatedProcessDescriptors = Stream.concat(additionalRelatedProcessDescriptors, tableRelatedProcessDescriptors).collect(GuavaCollectors.distinctBy(RelatedProcessDescriptor::getProcessId));
}
return relatedProcessDescriptors.filter(relatedProcess -> isEligible(relatedProcess, preconditionsContext, userRolePermissions)).map(relatedProcess -> toWebuiRelatedProcessDescriptor(relatedProcess, preconditionsContext));
}
Aggregations