<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How can I disable Permission checks?</title><link>https://answers.axonivy.com/questions/744/how-can-i-disable-permission-checks</link><description>&lt;p&gt;I have a process that does some administrative tasks that requires a lot of Axon.ivy permissions. The user that executes the task does not own all of the required permissions. &lt;/p&gt;
&lt;p&gt;But I as a process designer know what I do and I want to give the user the possibility to execute the administrative task without the necessary Axon.ivy permissions. I implement the security in the process itself by guarding the process start with a certain role for example. &lt;/p&gt;
&lt;p&gt;How can I disable programmatically Axon.ivy Security/Permission checks?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/744/how-can-i-disable-permission-checks" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 05 Jun 2014 09:55:39 -0400</lastBuildDate><item><title>Answer by Reto Weiss</title><link>https://answers.axonivy.com/questions/744/how-can-i-disable-permission-checks/746</link><description>&lt;p&gt;&lt;strong&gt;Axon.ivy 7.0 and newer&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;There is a convenience checkbox on the 'Script Activity' below the code block which will turn of permission check completely. Just hit it and fire your administrative API call here.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.processmodeling.html#ivy-processmodels-elements-tabs-code"&gt;https://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.processmodeling.html#ivy-processmodels-elements-tabs-code&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;All Versions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You can disable Xpert.ivy Security checks with the following code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import java.util.concurrent.Callable;
import ch.ivyteam.ivy.server.ServerFactory;

public class AdministrationTask 
{
    public static void doAdminTask() throws Exception
    {
        ServerFactory.getServer().getSecurityManager().executeAsSystem(new Callable&amp;lt;Void&amp;gt;(){
            @Override
            public Void call() throws Exception {

                // Implement your code here. Permission checks are disabled in this method.

                return null;
            }});
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that the method is called &lt;code&gt;executeAsSystem(...)&lt;/code&gt;. There is a similar method on the ISecurityContext called &lt;code&gt;executeAsSystemUser(...)&lt;/code&gt;. The difference between the two methods is that &lt;code&gt;executeAsSystem(...)&lt;/code&gt; disables all permission checks whereas &lt;code&gt;executeAsSystemUser(...)&lt;/code&gt; executes the code as user SYSTEM with permission checks enabled. With &lt;code&gt;executeAsSystemUser(...)&lt;/code&gt; if the SYSTEM user does not own a necessary permission then Xpert.ivy will also throw a PermissionDeniedException. Whereas with &lt;code&gt;executeAsSystem(...)&lt;/code&gt; no PermissionDeniedException will ever by thrown.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reto Weiss</dc:creator><pubDate>Thu, 05 Jun 2014 09:55:39 -0400</pubDate><guid>https://answers.axonivy.com/questions/744/how-can-i-disable-permission-checks/746</guid></item></channel></rss>