Search in sources :

Example 1 with IUserRolePermissions

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();
}
Also used : UserRolePermissionsKey(de.metas.security.UserRolePermissionsKey) IUserRolePermissions(de.metas.security.IUserRolePermissions)

Example 2 with IUserRolePermissions

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));
}
Also used : DisplayPlace(de.metas.process.RelatedProcessDescriptor.DisplayPlace) IExpression(org.adempiere.ad.expression.api.IExpression) DefaultValueExpressionsFactory(de.metas.ui.web.window.descriptor.factory.standard.DefaultValueExpressionsFactory) InterfaceWrapperHelper(org.adempiere.model.InterfaceWrapperHelper) IRangeAwareParams(org.adempiere.util.api.IRangeAwareParams) GuavaCollectors(de.metas.util.GuavaCollectors) ProcessDescriptor(de.metas.ui.web.process.descriptor.ProcessDescriptor) IExpressionFactory(org.adempiere.ad.expression.api.IExpressionFactory) DateRangeValue(de.metas.ui.web.window.datatypes.DateRangeValue) NonNull(lombok.NonNull) RelatedProcessDescriptor(de.metas.process.RelatedProcessDescriptor) ConstantLogicExpression(org.adempiere.ad.expression.api.ConstantLogicExpression) JavaProcess(de.metas.process.JavaProcess) X_AD_Process(org.compiere.model.X_AD_Process) DocumentFieldDescriptor(de.metas.ui.web.window.descriptor.DocumentFieldDescriptor) I_AD_Process(org.compiere.model.I_AD_Process) EntityNotFoundException(de.metas.ui.web.exceptions.EntityNotFoundException) Stream(java.util.stream.Stream) ProcessId(de.metas.ui.web.process.ProcessId) DocumentEntityDataBindingDescriptorBuilder(de.metas.ui.web.window.descriptor.DocumentEntityDataBindingDescriptor.DocumentEntityDataBindingDescriptorBuilder) Builder(lombok.Builder) IProcessPreconditionsContext(de.metas.process.IProcessPreconditionsContext) DocumentFieldWidgetType(de.metas.ui.web.window.descriptor.DocumentFieldWidgetType) Optional(java.util.Optional) ProcessParams(de.metas.process.ProcessParams) IADElementDAO(org.adempiere.ad.element.api.IADElementDAO) DocumentType(de.metas.ui.web.window.datatypes.DocumentType) IADTableDAO(org.adempiere.ad.table.api.IADTableDAO) LogManager(de.metas.logging.LogManager) TimeUtil(org.compiere.util.TimeUtil) LookupDescriptorProvider(de.metas.ui.web.window.descriptor.LookupDescriptorProvider) ILogicExpression(org.adempiere.ad.expression.api.ILogicExpression) SqlLookupDescriptor(de.metas.ui.web.window.descriptor.sql.SqlLookupDescriptor) I_AD_Process_Para(org.compiere.model.I_AD_Process_Para) Supplier(java.util.function.Supplier) ProcessDescriptorType(de.metas.ui.web.process.descriptor.ProcessDescriptor.ProcessDescriptorType) DescriptorsFactoryHelper(de.metas.ui.web.window.descriptor.factory.standard.DescriptorsFactoryHelper) IUserRolePermissions(de.metas.security.IUserRolePermissions) LookupDescriptor(de.metas.ui.web.window.descriptor.LookupDescriptor) Characteristic(de.metas.ui.web.window.descriptor.DocumentFieldDescriptor.Characteristic) ICalloutField(org.adempiere.ad.callout.api.ICalloutField) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor) InternalName(de.metas.ui.web.process.descriptor.InternalName) I_AD_Element(org.compiere.model.I_AD_Element) CoalesceUtil(de.metas.util.lang.CoalesceUtil) BarcodeScannerType(de.metas.process.BarcodeScannerType) Nullable(javax.annotation.Nullable) IADProcessDAO(de.metas.process.IADProcessDAO) LookupValue(de.metas.ui.web.window.datatypes.LookupValue) AdWindowId(org.adempiere.ad.element.api.AdWindowId) Check(de.metas.util.Check) Logger(org.slf4j.Logger) IModelTranslationMap(de.metas.i18n.IModelTranslationMap) ProcessLayout(de.metas.ui.web.process.descriptor.ProcessLayout) WebuiRelatedProcessDescriptor(de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor) CCache(de.metas.cache.CCache) Services(de.metas.util.Services) ProcessPreconditionsResolution(de.metas.process.ProcessPreconditionsResolution) DocumentEntityDataBindingDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDataBindingDescriptor) AdTabId(org.adempiere.ad.element.api.AdTabId) WebuiPreconditionsContext(de.metas.ui.web.process.WebuiPreconditionsContext) Stream(java.util.stream.Stream) AdTabId(org.adempiere.ad.element.api.AdTabId) RelatedProcessDescriptor(de.metas.process.RelatedProcessDescriptor) WebuiRelatedProcessDescriptor(de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor) AdWindowId(org.adempiere.ad.element.api.AdWindowId)

Aggregations

IUserRolePermissions (de.metas.security.IUserRolePermissions)2 CCache (de.metas.cache.CCache)1 IModelTranslationMap (de.metas.i18n.IModelTranslationMap)1 LogManager (de.metas.logging.LogManager)1 BarcodeScannerType (de.metas.process.BarcodeScannerType)1 IADProcessDAO (de.metas.process.IADProcessDAO)1 IProcessPreconditionsContext (de.metas.process.IProcessPreconditionsContext)1 JavaProcess (de.metas.process.JavaProcess)1 ProcessParams (de.metas.process.ProcessParams)1 ProcessPreconditionsResolution (de.metas.process.ProcessPreconditionsResolution)1 RelatedProcessDescriptor (de.metas.process.RelatedProcessDescriptor)1 DisplayPlace (de.metas.process.RelatedProcessDescriptor.DisplayPlace)1 UserRolePermissionsKey (de.metas.security.UserRolePermissionsKey)1 EntityNotFoundException (de.metas.ui.web.exceptions.EntityNotFoundException)1 ProcessId (de.metas.ui.web.process.ProcessId)1 WebuiPreconditionsContext (de.metas.ui.web.process.WebuiPreconditionsContext)1 InternalName (de.metas.ui.web.process.descriptor.InternalName)1 ProcessDescriptor (de.metas.ui.web.process.descriptor.ProcessDescriptor)1 ProcessDescriptorType (de.metas.ui.web.process.descriptor.ProcessDescriptor.ProcessDescriptorType)1 ProcessLayout (de.metas.ui.web.process.descriptor.ProcessLayout)1