Created
March 29, 2011 18:13
-
-
Save peterdietz/892895 to your computer and use it in GitHub Desktop.
quick and dirty look at restricting hits based on items user has authorization to actually view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// now instantiate the results and put them in their buckets | |
for (int i = 0; i < qResults.getHitTypes().size(); i++) | |
{ | |
Integer myType = qResults.getHitTypes().get(i); | |
// add the handle to the appropriate lists | |
switch (myType.intValue()) | |
{ | |
case Constants.ITEM: | |
Item item = Item.find(context, qResults.getHitIds().get(i)); | |
if (AuthorizeManager.authorizeActionBoolean(context, item, Constants.READ)) | |
{ | |
itemCount++; | |
} | |
break; | |
case Constants.COLLECTION: | |
collCount++; | |
break; | |
case Constants.COMMUNITY: | |
commCount++; | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment