~~~~~~~~~~
Background~~~~~~~~~~if using API to create a business object for a non-administrative account and then an exception may occur like this :The current user don ' t has the Modify permission on Team. ~~~~~~~~~~
Solution~~~~~~~~~~1. ADD ACL to domain '/system ' like the setting as below:but this solution are too loose, and may cause someone update The team member incorrectly. 2. To set the user of the session to being the administrator, which is to use Administrator's permission to do the creation.
1 //Get The current session before setting the admin.2Sessioncontext previous =Sessioncontext.newcontext ();3 4 Try {5 //To set the user's session to be the administrator6 SessionHelper.manager.setAdministrator ();7 8 //To set the user's session to be a specific user9 //SessionHelper.manager.setPrincipal (wtuser);Ten //Add call to create business object here. One A } - - the finally { - Sessioncontext.setcontext (previous); -}
Avoid Exception:have no modify permission on Team while creating business object.