[Anthill-pro] How to set a permission on a workflow.

emerson cargnin echofloripa.yell at gmail.com
Fri Jun 6 11:59:44 CDT 2008


Hi

I'm trying to create a script using the remoting api to apply an
execution permission for a certain role to all deployment workflow.

So far I have the script below. I couldn't find in the documentation
how to add/change permissions in a workflow.

Can I get some help on this?

thanks
emerson

import com.urbancode.anthill3.main.client.AnthillClient;
import com.urbancode.anthill3.persistence.UnitOfWork;
import com.urbancode.anthill3.domain.project.*;
import com.urbancode.anthill3.domain.workflow.*;
String serverHost = "subversion";
int serverPort = 4567;
String userName = "admin";
String password = "miche77";
// obtain connection to the Anthill server
AnthillClient anthill = AnthillClient.connect(serverHost, serverPort,
userName, password);
// create a Unit of Work
UnitOfWork uow = anthill.createUnitOfWork();
// Project

    //adding role permission to all deployment workflows
    Project[] projects = ProjectFactory.getInstance().restoreAll();
    for (int i = 0; i < projects.length; i++) {
      Project project=projects[i];
      Workflow[] workflowArray = project.getWorkflowArray();
      for (int j = 0; j < workflowArray.length; j++) {
        Workflow workflow = workflowArray[j];
        if (workflow.getName().indexOf("deploy")>0) {
           System.out.print(project.getName()+"  -
"+workflow.getName()+"--"+workflow.getDescription());
           System.out.println();
        }
      }

    }
uow.commitAndClose();


More information about the Anthill-pro mailing list