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

Eric Minick etm at urbancode.com
Wed Jun 11 20:30:03 CDT 2008


Emerson,

Try something like this:



Workflow workflow = WorkflowFactory.getInstance().restore(new Long(891L));
Resource resource = 
ResourceFactory.getInstance().restoreForPersistent(workflow);
Role role = RoleFactory.getInstance().restoreForName("User");

uow.commit();

Permission[] perms = 
PermissionFactory.getInstance().restoreAllForResource(resource);
for (int p=0; p<perms.length; p++) {
   if (perms[p].getRole().equals(role)) {
       perms[p].delete();
   }
}
uow.commitAndClose();

-- Eric

emerson cargnin wrote:
> I got it working already.
> But I still need to know hw to remove a permission programatically...
>
> thanks
>
> On 10/06/2008, emerson cargnin <echofloripa.yell at gmail.com> wrote:
>   
>> Can I have a follow up on this one?
>>
>> Thanks
>> Emerson
>>
>> On 06/06/2008, emerson cargnin <echofloripa.yell at gmail.com> wrote:
>>     
>>> 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
>>>
>>>       
>
>   
> _______________________________________________
> Anthill-pro mailing list
> Anthill-pro at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill-pro
>   


More information about the Anthill-pro mailing list