Avoid exception: Have no modify permission on Team when creating business object.

~~~~~~~~~~Background~~~~~~~~~~

If using API to create a business object for a non-administrative account, then an exception may occur like this: the current user don‘t have the modify permission on team.

~~~~~~~~~~Solution~~~~~~~~~~

1. Add ACL to domain "/System(Site)" like the setting as below:

But this solution is too loose, and may cause someone update the team member incorrectly.

2. To set the user of the session to be the administrator, which is to use administrator‘s permission to do the creation.

 1 // Get the current session before setting the admin.
 2 SessionContext previous = SessionContext.newContext();
 3
 4 try {
 5    // To set the user of the session to be the administrator
 6    SessionHelper.manager.setAdministrator();
 7
 8    // To set the user of the session to be a specific user
 9    // SessionHelper.manager.setPrincipal(WTUser);
10    // add call to create business object here.
11
12 }
13
14
15 finally {
16     SessionContext.setContext(previous);
17 }
时间: 2024-10-23 20:20:33

Avoid exception: Have no modify permission on Team when creating business object.的相关文章

permission 文档 翻译 运行时权限

文档位置:API24/guide/topics/security/permissions.html System Permissions 系统权限 Android is a privilege-separated operating system, in which each application runs with a distinct system identity (Linux user ID and group ID). Parts of the system are also sep

Java Tips and Best practices to avoid NullPointerException

A NullPointerException in Java application is best way to solve it and that is also key to write robust programs which can work smoothly. As it said “prevention is better than cure”, same is true with nasty NullPointerException. Thankfully by applyin

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener

十月 30, 2019 11:12:35 下午 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanC

Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException:

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoSupport': Injection of resou

?--Porg.springframework.beans.MethodInvocationException: Property 'username' threw exception; nested exception is java.lang.NullPointerException

使用BoneCP作为连接池,在启动Tomcat报出以下异常: 一月 02, 2016 2:12:17 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:mynewdpi' did not find a

Exception in thread "main" java.lang.IllegalArgumentException

1.错误描述 Exception in thread "main" java.lang.IllegalArgumentException: Cannot format given Object as a Date at java.text.DateFormat.format(DateFormat.java:301) at java.text.Format.format(Format.java:157) at com.you.util.DateBefore.getMonthBefore(

nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException

You should autowire interface AbstractManager instead of class MailManager. If you have different implemetations of AbstractManager you can write @Component("mailService") and then @Autowired @Qualifier("mailService") combination to au

spring quartz:Instantiation of bean failed; nested exception is java.lang.IncompatibleClassChangeErr

spring 调度类初始化失败,分析是jar包冲突,日志如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduler' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationConte

Java AOP nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice || Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0' 两个异常解决办法

贴出applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://ww