本文整理汇总了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);
}
}
示例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());
}
示例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;
}
示例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
}
示例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());
}
示例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);
}
示例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();
}
示例8: getUserRolePermissions
import org.compiere.util.Env; //导入方法依赖的package包/类
private final IUserRolePermissions getUserRolePermissions()
{
if (userRolePermissions != null)
{
return userRolePermissions;
}
return Env.getUserRolePermissions();
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例13: getUserRolePermissions
import org.compiere.util.Env; //导入方法依赖的package包/类
public final IUserRolePermissions getUserRolePermissions()
{
if (_userRolePermissions == null)
{
return Env.getUserRolePermissions(getCtx());
}
return _userRolePermissions;
}
示例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);
}
示例15: getUserRolePermissions
import org.compiere.util.Env; //导入方法依赖的package包/类
public IUserRolePermissions getUserRolePermissions()
{
return Env.getUserRolePermissions(getData().getCtx());
}