LumHonPeng

Has anyone managed to obtain accurate list of users assigned secondary institution roles via UserDbLoader.Default.getInstance().loadByPortalRoleId(portalId);

Discussion created by LumHonPeng on Jan 17, 2016
Latest reply on Mar 1, 2016 by LumHonPeng

Hi,

 

I am looking at retrieving a list of all users with secondary portal roles via the following code (test in staging). A random check showed that (based on GUI secondary institution role assignment count) the list of user for secondary institution role returned was incorrect. Database query was accurate. Can we check if anyone has managed to use the "loadByPortalRoleId" successfully to get a correct list of 2ndary portal roles?

http://library.blackboard.com/ref/72b6dc32-b778-4074-a670-4baed55b21f5/blackboard/persist/user/UserDbLoader.html#loadByPortalRoleId(blackboard.persist.Id)

 

Thank you.

 

Regards,

Lum

 

------- START CODE - Called from JSP in building block via URL call from console. -----

String wnSep = "#";
public String getAllPortalRoleString()
{
  ArrayList retPRlist = null;
  try{
     retPRlist = (ArrayList)PortalRoleDbLoader.Default.getInstance().loadAll();
      String retVal = null;  

      boolean retUserPKRoleID = (qryParam!=null && qryParam.equalsIgnoreCase("list"))?true:false;

      for (int x=0; retPRlist!=null && x < retPRlist.size(); x++)   

      {

          PortalRole tmpPR = retPRlist.get(x);

          if (tmpPR == null) continue;    

          Id prId = tmpPR.getId();    

          String rPK = tmpPR.getRoleID();    

          rPK = (rPK==null || rPK.trim().length()<1)?null:rPK.trim();     

          if (rPK == null) continue;    

          if (prId == null) continue;    

          Iterator uIter = uAL.iterator();    

          while (uIter!=null && uIter.hasNext())    

          {

              User u = uIter.next();

              if (u ==null) continue;

              String uPK = u.getBatchUid();

              uPK = (uPK==null || uPK.trim().length()<1)?null:uPK.trim().replaceAll(",","");

              if (uPK == null) continue;

              String oneUR =  uPK + wnSep + rPK;

              if (retVal ==null) retVal = oneUR;

              else retVal = retVal +mySeparator+ oneUR;

          }// while

      }// for

    }catch(Exception pe){   }

    return retVal;

  }// getAllPortalRoleString()

------ END CODE -----

Outcomes