如何隐藏特定角色的自定义工作流程?

时间:2011-06-06 09:39:26

标签: java xml alfresco

我正在使用角色和权限。我必须创建一个权限,隐藏创建的自定义工作流的特定角色。当我在xml中添加此bean文件和向导时,我根本无法启动工作流。如果有任何其他方式,请告诉我。


这是我创建的bean文件

public List getResources()    {       this.resources = new ArrayList(4);

  UserTransaction tx = null;
  try
  {
     FacesContext context = FacesContext.getCurrentInstance();
     tx = Repository.getUserTransaction(context, true);
     tx.begin();

     for (String newItem : this.packageItemsToAdd)
     {
        NodeRef nodeRef = new NodeRef(newItem);
        if (this.getNodeService().exists(nodeRef))
        {
           // create our Node representation
           MapNode node = new MapNode(nodeRef, this.getNodeService(), true);
           this.browseBean.setupCommonBindingProperties(node);

           // add property resolvers to show path information
           node.addPropertyResolver("path", this.browseBean.resolverPath);
           node.addPropertyResolver("displayPath", this.browseBean.resolverDisplayPath);

           this.resources.add(node);
        }
        else
        {
           if (logger.isDebugEnabled())
              logger.debug("Ignoring " + nodeRef + " as it has been removed from the repository");
        }
     }

     // commit the transaction
     tx.commit();
  }
  catch (Throwable err)
  {
     Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
           FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
     this.resources = Collections.<Node>emptyList();
     try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
  }

  return this.resources;

}

这里是bean implimentatin protected void resetRichList()    {       if(this.packageItemsRichList!= null)       {          this.packageItemsRichList.setValue(NULL);          this.packageItemsRichList = null;       }    }

这是xml文件                                                   合作者                                                                                                                                                                                                            

1 个答案:

答案 0 :(得分:3)

我可以回答这个问题,但你的问题太模糊了。

如果我只是看问题,那么它非常简单 - &gt;只需创建一个评估自定义工作流操作的评估程序。

找到文件web-client-config-workflow-actions。

更改或覆盖此代码:

    <action id="start_workflow">
            <label-id>start_workflow</label-id>
            <image>/images/icons/new_workflow.gif</image>
            <evaluator>org.alfresco.web.action.evaluator.StartWorkflowEvaluator</evaluator>
            <action>wizard:startWorkflow</action>
            <action-listener>#{WizardManager.setupParameters}</action-listener>
            <params>
               <param name="item-to-workflow">#{actionContext.id}</param>
            </params>
    </action>

更改此行:

<evaluator>org.alfresco.web.action.evaluator.StartWorkflowEvaluator</evaluator>

到您的自定义Java类并检查正确的权限,或者只是添加

<permissions>
    <permission allow="true">Your Role aka Write, Collaborator, etc</permission>
</permissions>