Extending setApplyAccessFilter to control params

Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883
This commit is contained in:
Redhuan D. Oon 2010-03-23 13:35:21 +00:00
parent a2f86be02f
commit 6950243e5b
1 changed files with 16 additions and 1 deletions

View File

@ -75,6 +75,8 @@ public class Query
private String trxName = null;
private Object[] parameters = null;
private boolean applyAccessFilter = false;
private boolean applyAccessFilterRW = false;
private boolean applyAccessFilterFullyQualified = true;
private boolean onlyActiveRecords = false;
private boolean onlyClient_ID = false;
private int onlySelection_ID = -1;
@ -172,6 +174,19 @@ public class Query
return this;
}
/**
* Turn on data access filter with controls
* @param flag
*/
public Query setApplyAccessFilter(boolean fullyQualified, boolean RW)
{
this.applyAccessFilter = true;
this.applyAccessFilterFullyQualified = fullyQualified;
this.applyAccessFilterRW = RW;
return this;
}
/**
* Select only active records (i.e. IsActive='Y')
* @param onlyActiveRecords
@ -678,7 +693,7 @@ public class Query
if (applyAccessFilter)
{
MRole role = MRole.getDefault(this.ctx, false);
sql = role.addAccessSQL(sql, table.getTableName(), true, false);
sql = role.addAccessSQL(sql, table.getTableName(), applyAccessFilterFullyQualified, applyAccessFilterRW);
}
if (CLogMgt.isLevelFinest()) log.finest("TableName = "+table.getTableName()+"... SQL = " +sql); //red1 - to assist in debugging SQL
return sql;