I have a process that does some administrative tasks that requires a lot of Xpert.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 possiblity to execute the administrative task without the necessary Xpert.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 Xpert.ivy Security/Permission checks?

asked 05.06.2014 at 09:39

Reto%20Weiss's gravatar image

Reto Weiss ♦♦
4.3k172450
accept rate: 73%


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.3k172450
accept rate: 73%

Your answer
toggle preview

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:

×34

Asked: 05.06.2014 at 09:39

Seen: 1,755 times

Last updated: 05.06.2014 at 09:55