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.

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.

How can I disable programmatically Axon.ivy Security/Permission checks?

asked 05.06.2014 at 09:39

Reto%20Weiss's gravatar image

Reto Weiss ♦♦
4.9k202857
accept rate: 74%

edited 22.05.2019 at 08:30

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958


Axon.ivy 7.0 and newer

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.

https://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.processmodeling.html#ivy-processmodels-elements-tabs-code

All Versions

You can disable Xpert.ivy Security checks with the following code:

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<Void>(){
            @Override
            public Void call() throws Exception {

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

                return null;
            }});
    }
}

Note that the method is called executeAsSystem(...). There is a similar method on the ISecurityContext called executeAsSystemUser(...). The difference between the two methods is that executeAsSystem(...) disables all permission checks whereas executeAsSystemUser(...) executes the code as user SYSTEM with permission checks enabled. With executeAsSystemUser(...) if the SYSTEM user does not own a necessary permission then Xpert.ivy will also throw a PermissionDeniedException. Whereas with executeAsSystem(...) no PermissionDeniedException will ever by thrown.

link

answered 05.06.2014 at 09:55

Reto%20Weiss's gravatar image

Reto Weiss ♦♦
4.9k202857
accept rate: 74%

edited 22.05.2019 at 08:04

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×40

Asked: 05.06.2014 at 09:39

Seen: 5,044 times

Last updated: 22.05.2019 at 08:30