Expand my Community achievements bar.

Join us LIVE in San Francisco on November 14th for Experience Makers The Skill Exchange. Don't miss out on this free learning event!

Removing Inherited Permissions from a Task via the API

Avatar

Level 10
Hi @Melinda Layten - this might be your area of specialty and I'd love a gem of wisdom. My scenari o is that I have a project template which contains 1 task. Via the API I am successfully attaching this template to a project, which creates the single task. I am then making another API call to change the sharing settings (accessRules) of the Task so that the project owner will have Contribute level access to prevent them from being able to delete the Task. The new rule is added OK, but the issue is that the inherited access rules from the project still also exist, meaning that the project owner still has Manage level access to the task which overrides the Contribute level access. Via the regular Workfront user interface, I can change the Task sharing settings to not automatically inherit permissions, but I don't know how to do this via the API. For your reference, the PUT query I'm doing to change the project owner's permissions to Contribute is: https://ourdomain.my.workfront.com/attask/api/v9.0/task?updates=[{"ID":"5cbea62800b954c608cdbe99ea4d12c3",accessRules:[{"accessorID": "59c0506400936d0349f1b49e895fb6c1","accessorObjCode": "USER","coreAction": "LIMITED_EDIT"}]}] When I do a GET query to read the accessRules from the task, I see the newly created rule, plus two others that are inherited from the project. I want to get rid of those two. Hope someone can point me in the right direction. Thanks Regards, David Cornwell
3 Replies

Avatar

Community Advisor
Hi David, New territory for me as well, but in the interest of figuring out What's Different, I'd suggest you do a full (fields=*) API query of a Project/Task that works as desired via the UI sharing, and then compare that line by line against a Project/Task that isn't working as desired via your current API attempt. I'd expect some security-related setting to be different, and with clue that in hand, you might then find the handle to accomplishing the same behavior as the UI via the API. Regards, Doug Doug Den Hoed - AtAppStore Got Skills? Lend a hand! https://community.workfront.com/participate/unanswered-threads

Avatar

Level 10
Thanks @Doug Den Hoed - AtAppStore for the suggestion, but from my testing, there are no changes on the Task fields when inheritance is removed. It seems like everything sharing-related is set as the array of accessRules. I did some more testing, and when you have a brand new task with no sharing settings (i.e. only inheriting permissions from the project) then it actually has no Access Rules stored against the task. If you then add one access rule on the task for the project owner to have Contribute (LIMITED_EDIT) access then two more access rules also appear. Both of those access rules 'isInherited' fields say true, and the access rule I create for Contribute says false for isInherited. I still think I'm going to need to delete these inherited rules somehow. David Cornwell

Avatar

Community Advisor
I concur, David. From this "https://support.workfront.com/hc/en-us/articles/115003574147-API-Basics">API Basics help article, it appears access rules can be set, appended, and retrieved (as below); perhaps they will help you find the path (e.g. retrieve what's there, remove any inherited properties, then set the remainder back). Regards, Doug Creating an Access Rule You can create an access rule to determine who can access to an object. The following are examples of access rules you can set: To set a project so it is shared only with a user with ID "abc123" use the following request: GET /attask/api/v9.0/project/123abcxxxxxxxxxxxxxxxxxxxxxxxxxx?method=put &updates={ accessRules: [ {accessorID: 'abc123', accessorObjCode: 'USER', coreAction: 'VIEW'} ] } Alternatively, to share only with a new person and keep existing permissions intact: GET /attask/api/v9.0/project/123abcxxxxxxxxxxxxxxxxxxxxxxxxxx/share?method=put&accessorID=abc123&accessorObjCode=USER&coreAction=VIEW To retrieve the existing access rules: GET /attask/api/v9.0/project/123abcxxxxxxxxxxxxxxxxxxxxxxxxxx?fields=accessRules:* Doug Den Hoed - AtAppStore Got Skills? Lend a hand! https://community.workfront.com/participate/unanswered-threads