How can i create new permission and add that in
- 4 years ago
Hi Haider
I'm able to create permission and attach it to the item. Between which user account are you using ? I tried to use Super User and it is working but it will not work for the normal user as there is no access defined for the permission added. I added creator to the permission which is getting created and provided update access.
Use below method (onBeforeAdd)
Innovator inn = this.getInnovator();
string docid = this.getID();
Item permissions = this.newItem("Permission", "add");
permissions.setProperty("name", docid);
Item access = this.newItem("Access", "add");
access.setProperty("can_get","1");
access.setProperty("can_update","1");
access.setProperty("can_discover","1");
access.setProperty("can_change_access","1");
access.setProperty("related_id","8FE5430B42014D94AE83246F299D9CC4");
permissions.addRelationship(access);
permissions.setProperty("name", docid);
permissions = permissions.apply();
this.setProperty("permission_id", permissions.getID());
return this;Thanks
Gopikrishnan R