当前位置: 首页>>代码示例>>Java>>正文


Java Env.getUserRolePermissions方法代码示例

本文整理汇总了Java中org.compiere.util.Env.getUserRolePermissions方法的典型用法代码示例。如果您正苦于以下问题:Java Env.getUserRolePermissions方法的具体用法?Java Env.getUserRolePermissions怎么用?Java Env.getUserRolePermissions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.compiere.util.Env的用法示例。


在下文中一共展示了Env.getUserRolePermissions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateDocActions

import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
public void updateDocActions(final IDocActionOptionsContext optionsCtx)
{
	//
	// First, run the default customizer
	DefaultDocActionOptionsCustomizer.instance.customizeValidActions(optionsCtx);

	//
	// Apply specific customizer
	final String tableName = optionsCtx.getTableName();
	final IDocActionOptionsCustomizer customizer = getDocActionOptionsCustomizerOrNull(tableName);
	if (customizer != null)
	{
		customizer.customizeValidActions(optionsCtx);
	}

	//
	// Apply role access
	final int docTypeId = optionsCtx.getC_DocType_ID();
	if (docTypeId > 0)
	{
		final Properties ctx = optionsCtx.getCtx();
		final IUserRolePermissions role = Env.getUserRolePermissions(ctx);
		role.applyActionAccess(optionsCtx);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:27,代码来源:DocActionOptionsBL.java

示例2: fetchProcesses

import org.compiere.util.Env; //导入方法依赖的package包/类
public List<SwingRelatedProcessDescriptor> fetchProcesses(final Properties ctx, final GridTab gridTab)
{
	if (gridTab == null)
	{
		return ImmutableList.of();
	}

	final IUserRolePermissions role = Env.getUserRolePermissions(ctx);
	Check.assumeNotNull(role, "No role found for {}", ctx);

	final int AD_Table_ID = gridTab.getAD_Table_ID();
	final int AD_Window_ID = gridTab.getAD_Window_ID();
	final IProcessPreconditionsContext preconditionsContext = gridTab.toPreconditionsContext();

	return Services.get(IADProcessDAO.class).retrieveRelatedProcessesForTableIndexedByProcessId(ctx, AD_Table_ID, AD_Window_ID)
			.values().stream()
			.filter(relatedProcess -> isExecutionGrantedOrLog(relatedProcess, role))
			.map(relatedProcess -> createSwingRelatedProcess(relatedProcess, preconditionsContext))
			.filter(this::isEnabledOrLog)
			.collect(GuavaCollectors.toImmutableList());
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:22,代码来源:AProcessModel.java

示例3: createTerminalLoginDialog

import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
public ITerminalLoginDialog createTerminalLoginDialog(final ITerminalBasePanel parent)
{
	final IUserRolePermissions role = Env.getUserRolePermissions();
	final ITerminalLoginDialog dialog;
	if (role.getStartup_AD_Form_ID() > 0)
	{
		// Case: user logged in and it has a form to be shown instead of standard main window (see AMenu)
		dialog = new DirectTerminalLoginDialog();
	}
	else
	{
		dialog = new SwingTerminalLoginDialog(parent);
	}

	addToDisposableComponents(dialog);
	return dialog;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:19,代码来源:SwingTerminalFactory.java

示例4: isChangeLogEnabled

import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
public boolean isChangeLogEnabled()
{
	//
	// Check if it's disabled for current thread
	final Boolean disableChangeLogsThreadLocalValue = disableChangeLogsThreadLocal.get();
	if (Boolean.TRUE.equals(disableChangeLogsThreadLocalValue))
	{
		return false;
	}

	//
	// Check if role allows us to create the change log
	final IUserRolePermissions role = Env.getUserRolePermissions();
	if (role == null || !role.hasPermission(IUserRolePermissions.PERMISSION_ChangeLog))
	{
		return false;
	}

	return true; // enabled
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:22,代码来源:SessionBL.java

示例5: applyDefaultFilter

import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
public IQueryBuilder<I_C_Invoice_Candidate> applyDefaultFilter(final IQueryBuilder<I_C_Invoice_Candidate> queryBuilder)
{
	Check.assumeNotNull(queryBuilder, "Query builder is null");

	final Properties ctx = queryBuilder.getCtx();

	// shall never happen
	if (ctx.isEmpty())
	{
		return queryBuilder;
	}

	// Only filter invoice candidates of the organizations this role has access to
	final IUserRolePermissions userRolePermissions = Env.getUserRolePermissions(ctx);

	return queryBuilder.addInArrayOrAllFilter(I_C_Invoice_Candidate.COLUMN_AD_Org_ID, userRolePermissions.getAD_Org_IDs_AsSet());

}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:20,代码来源:InvoiceCandDAO.java

示例6: getProcessData

import org.compiere.util.Env; //导入方法依赖的package包/类
public KeyNamePair[] getProcessData()
	{
		// Processes
		final IUserRolePermissions role = Env.getUserRolePermissions(); // metas
//		int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx());

		boolean trl = !Env.isBaseLanguage(Env.getCtx(), "AD_Process");
		String lang = Env.getAD_Language(Env.getCtx());
		// TODO: ASP - implement process and window access ASP control
		String sql = "SELECT DISTINCT p.AD_Process_ID,"
				+ (trl ? "trl.Name" : "p.Name ")
			+ " FROM AD_Process p INNER JOIN AD_Process_Access pa ON (p.AD_Process_ID=pa.AD_Process_ID) "
			+ (trl ? "LEFT JOIN AD_Process_Trl trl on (trl.AD_Process_ID=p.AD_Process_ID and trl.AD_Language=" + DB.TO_STRING(lang) + ")" : "")
			+ " WHERE "+role.getIncludedRolesWhereClause("pa.AD_Role_ID", null) // metas: use included roles
			+ " AND p.IsReport='Y' AND p.IsActive='Y' AND pa.IsActive='Y' "
			+ "ORDER BY 2";
		return DB.getKeyNamePairs(sql, true);
	}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:19,代码来源:Archive.java

示例7: getSQLDefaultFilter

import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
public String getSQLDefaultFilter(final Properties ctx)
{
	// Only filter invoice candidates of the organizations this role has access to
	final IUserRolePermissions userRolePermissions = Env.getUserRolePermissions(ctx);

	final StringBuilder defaultFilter = new StringBuilder("");

	final String orgIDsAsString = userRolePermissions.getAD_Org_IDs_AsString();

	if (!Check.isEmpty(orgIDsAsString))
	{

		defaultFilter.append(I_C_Invoice_Candidate.COLUMNNAME_AD_Org_ID)
				.append(" IN (")
				.append(orgIDsAsString)
				.append(")");

	}

	return defaultFilter.toString();
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:23,代码来源:InvoiceCandDAO.java

示例8: getUserRolePermissions

import org.compiere.util.Env; //导入方法依赖的package包/类
private final IUserRolePermissions getUserRolePermissions()
{
	if (userRolePermissions != null)
	{
		return userRolePermissions;
	}

	return Env.getUserRolePermissions();
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:10,代码来源:GridTabMaxRowsRestrictionChecker.java

示例9: evaluate

import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
public String evaluate(final Evaluatee ctx, final OnVariableNotFound onVariableNotFound) throws ExpressionEvaluationException
{
	try
	{
		//
		// Get the permissionsKey parameter
		final OnVariableNotFound permissionsKeyOnVariableNoFound = getOnVariableNotFoundForInternalParameter(onVariableNotFound);
		final String permissionsKey = StringExpressionsHelper.evaluateParam(PARAM_UserRolePermissionsKey, ctx, permissionsKeyOnVariableNoFound);
		if (permissionsKey == null || permissionsKey == IStringExpression.EMPTY_RESULT)
		{
			return IStringExpression.EMPTY_RESULT;
		}
		else if (permissionsKey.isEmpty() && onVariableNotFound == OnVariableNotFound.Empty)
		{
			return "";
		}

		final String sql = sqlExpression.evaluate(ctx, onVariableNotFound);
		if (Check.isEmpty(sql, true) || sql == EMPTY_RESULT)
		{
			return sql;
		}

		final IUserRolePermissions permissions = Env.getUserRolePermissions(permissionsKey);
		final String sqlFinal = permissions.addAccessSQL(sql, tableNameIn, fullyQualified, rw);
		return sqlFinal;
	}
	catch (final Exception e)
	{
		throw ExpressionEvaluationException.wrapIfNeeded(e)
				.addExpression(this);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:35,代码来源:AccessSqlStringExpression.java

示例10: retrieveItems

import org.compiere.util.Env; //导入方法依赖的package包/类
private MPrintFormatItem[] retrieveItems()
{
	final String whereClause = "AD_PrintFormat_ID=?"
		//	Display restrictions - Passwords, etc.
		+ " AND NOT EXISTS (SELECT * FROM AD_Field f "
			+ "WHERE AD_PrintFormatItem.AD_Column_ID=f.AD_Column_ID"
			+ " AND (f.IsEncrypted='Y' OR f.ObscureType IS NOT NULL))";
	
	final List<MPrintFormatItem> list = new Query(getCtx(), I_AD_PrintFormatItem.Table_Name, whereClause, get_TrxName())
			.setParameters(getAD_PrintFormat_ID())
			.setOrderBy(I_AD_PrintFormatItem.COLUMNNAME_SeqNo)
			.list();
	
	final IUserRolePermissions role = Env.getUserRolePermissions(getCtx());
	for(Iterator<MPrintFormatItem> it = list.iterator(); it.hasNext();)
	{
		final MPrintFormatItem pfi = it.next();
		if (!role.isColumnAccess(getAD_Table_ID(), pfi.getAD_Column_ID(), true)) // ro=true
		{
			it.remove();
		}
	}
	
	//
	MPrintFormatItem[] retValue = new MPrintFormatItem[list.size()];
	list.toArray(retValue);
	return retValue;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:29,代码来源:MPrintFormat.java

示例11: isRowEditable

import org.compiere.util.Env; //导入方法依赖的package包/类
private boolean isRowEditable(int row, boolean isAlwaysUpdateableColumn)
	{
// metas: end
	//	log.debug( "MTable.isRowEditable - Row=" + row);
		//	Entire Table not editable or no row
		if ((m_readOnly && !isAlwaysUpdateableColumn) || row < 0) // metas: check !isAlwaysUpdateableColumn
			return false;
		//	If not Active - not editable
		if (m_indexActiveColumn > 0)		//	&& m_TabNo != Find.s_TabNo)
		{
			Object value = getValueAt(row, m_indexActiveColumn);
			if (value instanceof Boolean)
			{
				if (!((Boolean)value).booleanValue())
					return false;
			}
			else if ("N".equals(value)) 
				return false;
		}
		//	If Processed - not editable (Find always editable)
		if (m_indexProcessedColumn > 0 // && m_TabNo != Find.s_TabNo)
				&& !isAlwaysUpdateableColumn) // metas
		{
			Object processed = getValueAt(row, m_indexProcessedColumn);
			if (processed instanceof Boolean)
			{
				if (((Boolean)processed).booleanValue())
					return false;
			}
			else if ("Y".equals(processed)) 
				return false;
		}
		//
		int[] co = getClientOrg(row);
		int AD_Client_ID = co[0]; 
		int AD_Org_ID = co[1];
		int Record_ID = getKeyID(row);
		final IUserRolePermissions role = Env.getUserRolePermissions(m_ctx);
		return role.canUpdate(AD_Client_ID, AD_Org_ID, m_AD_Table_ID, Record_ID, false);
	}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:41,代码来源:GridTable.java

示例12: getSql

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Get Sql
 * @param applySecurity apply role/client security
 * @return sql
 */
public String getSql(boolean applySecurity)
{
	StringBuffer sql = new StringBuffer();
	sql.append("SELECT ").append(getSelectClause())
		.append(" FROM ").append(getFromClause());
	if (getWhereClause() != null && getWhereClause().length() > 0)
		sql.append(" WHERE ").append(getWhereClause());
	String finalSQL = sql.toString();
	//
	// Apply Security:
	if (applySecurity) {
		MAlert alert = getParent();
		if (alert.isEnforceRoleSecurity()
				|| alert.isEnforceClientSecurity())
		{
			int AD_Role_ID = alert.getFirstAD_Role_ID();
			if (AD_Role_ID == -1)
				AD_Role_ID = alert.getFirstUserAD_Role_ID();
			if (AD_Role_ID != -1)
			{
				final IUserRolePermissions role = Env.getUserRolePermissions(getCtx());
				finalSQL = role.addAccessSQL(finalSQL, null, true, false);
			}
		}
	}
	//
	if (getOtherClause() != null && getOtherClause().length() > 0)
		finalSQL += " " + getOtherClause();
	return finalSQL;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:36,代码来源:MAlertRule.java

示例13: getUserRolePermissions

import org.compiere.util.Env; //导入方法依赖的package包/类
public final IUserRolePermissions getUserRolePermissions()
{
	if (_userRolePermissions == null)
	{
		return Env.getUserRolePermissions(getCtx());
	}
	return _userRolePermissions;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:9,代码来源:MTree.java

示例14: ValuePreference

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 *  Constructor
 *
 *  @param frame parent
 *  @param WindowNo window no
 *  @param AD_Client_ID client
 *  @param AD_Org_ID org
 *  @param AD_User_ID user
 *  @param AD_Window_ID window id
 *  @param Attribute attribute
 *  @param DisplayAttribute attribute display
 *  @param Value value
 *  @param DisplayValue calue display
 *  @param displayType display type
 *  @param AD_Reference_ID reference
 */
public ValuePreference (Frame frame, int WindowNo,
	int AD_Client_ID, int AD_Org_ID, int AD_User_ID, int AD_Window_ID,
	String Attribute, String DisplayAttribute, String Value, String DisplayValue,
	int displayType, int AD_Reference_ID)
{
	super(frame, Msg.getMsg(Env.getCtx(), NAME) + " " + DisplayAttribute, true);
	log.info("WindowNo=" + WindowNo
		+ ", Client_ID=" + AD_Client_ID + ", Org_ID=" + AD_Org_ID + ", User_ID=" + AD_User_ID + ", Window_ID=" + AD_Window_ID
		+ ",  Attribute=" + Attribute + "/" + DisplayAttribute + ",  Value=" + Value + "/" + DisplayValue
		+ ",  DisplayType=" + displayType + ", Reference_ID=" + AD_Reference_ID);
	m_ctx = Env.getCtx();
	m_WindowNo = WindowNo;
	m_AD_Client_ID = AD_Client_ID;
	m_AD_Org_ID = AD_Org_ID;
	m_AD_User_ID = AD_User_ID;
	m_AD_Window_ID = AD_Window_ID;
	m_Attribute = Attribute;
	m_DisplayAttribute = DisplayAttribute;
	m_Value = Value;
	m_DisplayValue = DisplayValue;
	m_DisplayType = displayType;
	//
	m_role = Env.getUserRolePermissions();
	try
	{
		jbInit();
		dynInit();
	}
	catch(Exception ex)
	{
		log.error("", ex);
	}
	AEnv.showCenterScreen(this);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:51,代码来源:ValuePreference.java

示例15: getUserRolePermissions

import org.compiere.util.Env; //导入方法依赖的package包/类
public IUserRolePermissions getUserRolePermissions()
{
	return Env.getUserRolePermissions(getData().getCtx());
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:5,代码来源:UserSession.java


注:本文中的org.compiere.util.Env.getUserRolePermissions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。