Hi all

During the time i've worked with ivy, i see there is some ways to execute code with system permission:

 - ServerFactory.getServer().getSecurityManager().executeAsSystem(callable) 
 - ServerFactory.getServer().getSecurityManager().executeAsSystem2(callable) 
 - Ivy.wf().getSecurityContext().executeAsSystemUser(callable)
 - SecurityManagerFactory.getSecurityManager().executeAsSystem(callable)

It make me confused, so can anyone explain the differences?

asked 02.05.2017 at 22:55

trungdv's gravatar image

trungdv
(suspended)
accept rate: 52%


These are all calls to the same method: ISecurityManager.executeAsSystem(callable). Just the navigation to that implementation is different:

ServerFactory.getServer().getSecurityManager().executeAsSystem(callable) 
Ivy.wf().getSecurityContext().executeAsSystemUser(callable)
SecurityManagerFactory.getSecurityManager().executeAsSystem(callable)
DiCore.getGlobalInjector.getInstance(ISecurityManager.class).executeAsSystem(callable)

alt text

The executeAsSystem2(Callable) is slightly different. It wraps the may thrown exception as PersistencyException. Since PersistencyException is also a RuntimeException, this method does not require a catch block to handle exceptional cases. alt text

link

answered 03.05.2017 at 02:45

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

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:

×147

Asked: 02.05.2017 at 22:55

Seen: 1,426 times

Last updated: 03.05.2017 at 02:45