コード例 #1
0
 public List<TaggableItem> getItems(
     TaggableActivity activity,
     TaggingProvider provider,
     boolean getMyItemsOnly,
     String taggedItem) {
   List<TaggableItem> items = new ArrayList<TaggableItem>();
   // Only return items to a specified rating provider
   if (ratingProviderIds.contains(provider.getId())) {
     WizardPageDefinition def = (WizardPageDefinition) activity.getObject();
     for (Iterator<WizardPage> i = def.getPages().iterator(); i.hasNext(); ) {
       // Make sure this page is evaluatable by the current
       // user
       WizardPage page = i.next();
       if (page != null
           && (page.getStatus().equals(MatrixFunctionConstants.PENDING_STATUS)
               || page.getStatus().equals(MatrixFunctionConstants.COMPLETE_STATUS))
           && (!getMyItemsOnly && canEvaluate(page))) {
         items.add(getItem(page));
       }
     }
   } else {
     // Notify other tagging providers that they aren't accepted here yet
     logger.warn(this + ".getItems(): Provider with id " + provider.getId() + " not allowed!");
   }
   return items;
 }
コード例 #2
0
 public List<TaggableItem> getItems(
     TaggableActivity activity,
     String userId,
     TaggingProvider provider,
     boolean getMyItemsOnly,
     String taggedItem) {
   List<TaggableItem> items = new ArrayList<TaggableItem>();
   // Return custom list of items to rating providers. This
   // list should match that seen in the evaluation item list (?)
   if (ratingProviderIds.contains(provider.getId())) {
     WizardPageDefinition def = (WizardPageDefinition) activity.getObject();
     for (Iterator<WizardPage> i = def.getPages().iterator(); i.hasNext(); ) {
       // Make sure this page is evaluatable by the current
       // user
       WizardPage page = i.next();
       if (page != null
           && (page.getStatus().equals(MatrixFunctionConstants.PENDING_STATUS)
               || page.getStatus().equals(MatrixFunctionConstants.COMPLETE_STATUS))
           && (page.getOwner().getId().getValue().equals(userId)
               || (!getMyItemsOnly && canEvaluate(page)))) {
         items.add(getItem(page));
         // There is only one submitted page per definition, so break
         // here
         break;
       }
     }
   } else {
     // Notify other tagging providers that they aren't accepted here yet
     logger.warn(this + ".getItems() 2: Provider with id " + provider.getId() + " not allowed!");
   }
   return items;
 }
コード例 #3
0
 public boolean allowRemoveTags(TaggableActivity activity) {
   WizardPageDefinition pageDef = (WizardPageDefinition) activity.getObject();
   // Try to get a wizard page sequence
   WizardPageSequence ps = wizardManager.getWizardPageSeqByDef(pageDef.getId());
   boolean authorized = false;
   if (ps != null) {
     Wizard wizard = ps.getCategory().getWizard();
     /*
      * If you own the wizard, or if you can delete wizards, or if you
      * can revise wizards, then you are able to delete page definitions
      * and can, therefore, remove tags.
      */
     authorized =
         sessionManager
                 .getCurrentSessionUserId()
                 .equalsIgnoreCase(wizard.getOwner().getId().getValue())
             || authzManager.isAuthorized(WizardFunctionConstants.EDIT_WIZARD, wizard.getId())
             || authzManager.isAuthorized(WizardFunctionConstants.DELETE_WIZARD, wizard.getId());
   } else {
     ScaffoldingCell cell = matrixManager.getScaffoldingCellByWizardPageDef(pageDef.getId());
     /*
      * If you can create or delete scaffolding, then you are able to
      * delete scaffolding cells and can, therefore, remove tags.
      */
     authorized =
         authzManager.isAuthorized(
                 MatrixFunctionConstants.CREATE_SCAFFOLDING, cell.getScaffolding().getId())
             || authzManager.isAuthorized(
                 MatrixFunctionConstants.DELETE_SCAFFOLDING_ANY, cell.getScaffolding().getId())
             || (authzManager.isAuthorized(
                     MatrixFunctionConstants.DELETE_SCAFFOLDING_OWN, cell.getScaffolding().getId())
                 && cell.getScaffolding()
                     .getOwner()
                     .getId()
                     .equals(getAuthnManager().getAgent().getId()));
   }
   return authorized;
 }