I am working with roles and permission's.i have to create an permission that hides the created custom workflow's for perticular role.when i am adding this bean file and the wizard in xml i am not able to start the workflow at all .please let me know if any other way is there.
this is the bean file i have created
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;
}
here is bean implimentatin protected void resetRichList() { if (this.packageItemsRichList != null) { this.packageItemsRichList.setValue(null); this.packageItemsRichList = null; } }this is the xml file Collaborator
I can answer this, but your question is too vague.
If I just look at the question, then it's very simpel --> Just create an evaluator which check on custom-workflow action.
Find the file web-client-config-workflow-actions.
Change or override this code:
<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>
Change this line:
<evaluator>org.alfresco.web.action.evaluator.StartWorkflowEvaluator</evaluator>
To your custom Java class and check on the right permission, or just add
<permissions>
<permission allow="true">Your Role aka Write, Collaborator, etc</permission>
</permissions>
精彩评论