[Anthill-pro] Enhancement: Template permissions / Getting all Agent
using remote script
emerson cargnin
echofloripa.yell at gmail.com
Tue Jun 17 04:50:04 CDT 2008
It would be great if there was a way to set up a common template for
permissions. For example, every new element would have a given set of
permissions that you can especify, you would have a different one for
each type, like for Agents, Projects, Workflows, etc. It's a real pain
to have to do it individually to each element, especialy using the
current GUI interface.
Meanwhile we don't get this fantastic feature.....
How do I get all agents in a system using remote scripting? Then I
will use the following to set up the permissions I need, let me know
if it is the right way:
//setting agent permissions
String roleName = "User"; // change to the name of the role you
want to grant permission to
Role role = RoleFactory.getInstance().restoreForName(roleName);
Agent[] agents=new Agent[10];
for (int i = 0; i < agents.length; i++) {
Resource resource
=ResourceFactory.getInstance().restoreForPersistent(agents[i]);
Permission perm = new Permission(true, resource, "read",role);
perm.store();
perm = new Permission(true, resource, "write",role);
perm.store();
}
Thank you
emerson
More information about the Anthill-pro
mailing list