use of org.adempiere.ad.security.UserRolePermissionsKey in project metasfresh-webui-api by metasfresh.
the class MenuRestController method getMenuTree.
private MenuTree getMenuTree() {
final UserRolePermissionsKey userRolePermissionsKey = userSession.getUserRolePermissionsKey();
final String adLanguage = userSession.getAD_Language();
return menuTreeRepository.getMenuTree(userRolePermissionsKey, adLanguage);
}
use of org.adempiere.ad.security.UserRolePermissionsKey in project metasfresh-webui-api by metasfresh.
the class MenuTreeLoader method getUserRolePermissions.
private IUserRolePermissions getUserRolePermissions() {
if (_userRolePermissions == null) {
final UserRolePermissionsKey userRolePermissionsKey = getUserRolePermissionsKey();
_userRolePermissions = userRolePermissionsDAO.retrieveUserRolePermissions(userRolePermissionsKey);
}
return _userRolePermissions;
}
use of org.adempiere.ad.security.UserRolePermissionsKey in project metasfresh-webui-api by metasfresh.
the class MenuTreeRepository method getUserSessionMenuTree.
public MenuTree getUserSessionMenuTree() {
final UserRolePermissionsKey userRolePermissionsKey = userSession.getUserRolePermissionsKey();
final String adLanguage = userSession.getAD_Language();
return getMenuTree(userRolePermissionsKey, adLanguage);
}
use of org.adempiere.ad.security.UserRolePermissionsKey in project metasfresh-webui-api by metasfresh.
the class SqlViewRowIdsOrderedSelectionFactory method createOrderedSelection.
@Override
public ViewRowIdsOrderedSelection createOrderedSelection(final ViewEvaluationCtx viewEvalCtx, final ViewId viewId, final List<DocumentFilter> filters, final List<DocumentQueryOrderBy> orderBys) {
final UserRolePermissionsKey permissionsKey = viewEvalCtx.getPermissionsKey();
final IUserRolePermissions permissions = Services.get(IUserRolePermissionsDAO.class).retrieveUserRolePermissions(permissionsKey);
final int queryLimit = permissions.getConstraint(WindowMaxQueryRecordsConstraint.class).or(WindowMaxQueryRecordsConstraint.DEFAULT).getMaxQueryRecordsPerRole();
//
//
final SqlCreateSelection sqlCreates = newSqlViewSelectionQueryBuilder().buildSqlCreateSelectionFrom(viewEvalCtx, viewId, filters, orderBys, queryLimit);
logger.trace("Creating selection using {}", sqlCreates);
// Create selection lines if any => insert into T_WEBUI_ViewSelectionLine
if (sqlCreates.getSqlCreateSelectionLines() != null) {
final SqlAndParams sqlCreateSelectionLines = sqlCreates.getSqlCreateSelectionLines();
final Stopwatch stopwatch = Stopwatch.createStarted();
final long linesCount = DB.executeUpdateEx(sqlCreateSelectionLines.getSql(), sqlCreateSelectionLines.getSqlParamsArray(), ITrx.TRXNAME_ThreadInherited);
logger.trace("Created selection lines {}, linesCount={}, duration={}", viewId, linesCount, stopwatch);
}
//
// Create selection rows => insert into T_WEBUI_ViewSelection
final long rowsCount;
{
final SqlAndParams sqlCreateSelection = sqlCreates.getSqlCreateSelection();
final Stopwatch stopwatch = Stopwatch.createStarted();
rowsCount = DB.executeUpdateEx(sqlCreateSelection.getSql(), sqlCreateSelection.getSqlParamsArray(), ITrx.TRXNAME_ThreadInherited);
logger.trace("Created selection {}, rowsCount={}, duration={}", viewId, rowsCount, stopwatch);
}
return ViewRowIdsOrderedSelection.builder().setViewId(viewId).setSize(rowsCount).setOrderBys(orderBys).setQueryLimit(queryLimit).build();
}
use of org.adempiere.ad.security.UserRolePermissionsKey in project metasfresh-webui-api by metasfresh.
the class ViewEvaluationCtx method newInstanceFromCurrentContext.
public static final ViewEvaluationCtx newInstanceFromCurrentContext() {
final Properties ctx = Env.getCtx();
final String adLanguage = Env.getAD_Language(ctx);
final UserRolePermissionsKey permissionsKey = UserRolePermissionsKey.of(ctx);
return new ViewEvaluationCtx(adLanguage, permissionsKey);
}
Aggregations