Avoid Exception:have no modify permission on Team while creating business object.

Source: Internet
Author: User
Tags to domain

~~~~~~~~~~ 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.