|
@@ -2183,15 +2183,19 @@ public:
|
|
|
const char *queryowner,
|
|
|
__int64 *cachehint,
|
|
|
ISecManager *secmgr,
|
|
|
- ISecUser *secuser)
|
|
|
+ ISecUser *secuser,
|
|
|
+ unsigned *total)
|
|
|
{
|
|
|
- class cScopeChecker: implements ISortedElementsTreeFilter
|
|
|
+ class CScopeChecker : public CSimpleInterface, implements ISortedElementsTreeFilter
|
|
|
{
|
|
|
UniqueScopes done;
|
|
|
ISecManager *secmgr;
|
|
|
ISecUser *secuser;
|
|
|
+ CriticalSection crit;
|
|
|
public:
|
|
|
- cScopeChecker(ISecManager *_secmgr,ISecUser *_secuser)
|
|
|
+ IMPLEMENT_IINTERFACE_USING(CSimpleInterface);
|
|
|
+
|
|
|
+ CScopeChecker(ISecManager *_secmgr,ISecUser *_secuser)
|
|
|
{
|
|
|
secmgr = _secmgr;
|
|
|
secuser = _secuser;
|
|
@@ -2201,14 +2205,23 @@ public:
|
|
|
const char *scopename = tree.queryProp("@scope");
|
|
|
if (!scopename||!*scopename)
|
|
|
return true;
|
|
|
- const bool *b = done.getValue(scopename);
|
|
|
- if (b)
|
|
|
- return *b;
|
|
|
+
|
|
|
+ {
|
|
|
+ CriticalBlock block(crit);
|
|
|
+ const bool *b = done.getValue(scopename);
|
|
|
+ if (b)
|
|
|
+ return *b;
|
|
|
+ }
|
|
|
bool ret = checkWuScopeSecAccess(scopename,*secmgr,secuser,SecAccess_Read,"iterating",false,false);
|
|
|
- done.setValue(scopename,ret);
|
|
|
+ {
|
|
|
+ // conceivably could have already been checked and added, but ok.
|
|
|
+ CriticalBlock block(crit);
|
|
|
+ done.setValue(scopename,ret);
|
|
|
+ }
|
|
|
return ret;
|
|
|
}
|
|
|
- } sc(secmgr,secuser);
|
|
|
+ };
|
|
|
+ Owned<ISortedElementsTreeFilter> sc = new CScopeChecker(secmgr,secuser);
|
|
|
StringBuffer query("*");
|
|
|
StringBuffer so;
|
|
|
StringAttr namefilterlo;
|
|
@@ -2249,7 +2262,7 @@ public:
|
|
|
}
|
|
|
IArrayOf<IPropertyTree> results;
|
|
|
Owned<IRemoteConnection> conn=getElementsPaged( "WorkUnits", query.str(), so.length()?so.str():NULL,startoffset,maxnum,
|
|
|
- secmgr?&sc:NULL,queryowner,cachehint,namefilterlo.get(),namefilterhi.get(),results);
|
|
|
+ secmgr?sc:NULL,queryowner,cachehint,namefilterlo.get(),namefilterhi.get(),results,total);
|
|
|
return new CConstWUArrayIterator(conn, results, secmgr, secuser);
|
|
|
}
|
|
|
|
|
@@ -2260,9 +2273,10 @@ public:
|
|
|
unsigned startoffset,
|
|
|
unsigned maxnum,
|
|
|
const char *queryowner,
|
|
|
- __int64 *cachehint)
|
|
|
+ __int64 *cachehint,
|
|
|
+ unsigned *total)
|
|
|
{
|
|
|
- return getWorkUnitsSorted(sortorder,filters,filterbuf,startoffset,maxnum,queryowner,cachehint, NULL, NULL);
|
|
|
+ return getWorkUnitsSorted(sortorder,filters,filterbuf,startoffset,maxnum,queryowner,cachehint, NULL, NULL, total);
|
|
|
}
|
|
|
|
|
|
virtual unsigned numWorkUnits()
|
|
@@ -2279,12 +2293,9 @@ public:
|
|
|
ISecManager *secmgr,
|
|
|
ISecUser *secuser)
|
|
|
{
|
|
|
- Owned<IConstWorkUnitIterator> iter = getWorkUnitsSorted( NULL,filters,filterbuf,0,0x7fffffff,NULL,NULL,secmgr,secuser);
|
|
|
- // this is rather slow but necessarily so (for security check)
|
|
|
- unsigned ret = 0;
|
|
|
- ForEach(*iter)
|
|
|
- ret++;
|
|
|
- return ret;
|
|
|
+ unsigned total;
|
|
|
+ Owned<IConstWorkUnitIterator> iter = getWorkUnitsSorted( NULL,filters,filterbuf,0,0x7fffffff,NULL,NULL,secmgr,secuser,&total);
|
|
|
+ return total;
|
|
|
}
|
|
|
|
|
|
virtual unsigned numWorkUnitsFiltered(WUSortField *filters,const void *filterbuf)
|
|
@@ -2494,9 +2505,10 @@ public:
|
|
|
unsigned startoffset,
|
|
|
unsigned maxnum,
|
|
|
const char *queryowner,
|
|
|
- __int64 *cachehint)
|
|
|
+ __int64 *cachehint,
|
|
|
+ unsigned *total)
|
|
|
{
|
|
|
- return factory->getWorkUnitsSorted(sortorder,filters,filterbuf,startoffset,maxnum,queryowner,cachehint, secMgr.get(), secUser.get());
|
|
|
+ return factory->getWorkUnitsSorted(sortorder,filters,filterbuf,startoffset,maxnum,queryowner,cachehint, secMgr.get(), secUser.get(), total);
|
|
|
}
|
|
|
|
|
|
virtual unsigned numWorkUnits()
|