[RTFACT-14884] Unable to switch to system role from within a method Created: 01/Sep/17 Updated: 14/May/18 Resolved: 14/May/18
|Project:||Artifactory Binary Repository|
asSystem block does not work correctly when attempting to use from a method:
Please re-work asSystem support to be able to use also from methods. It is important to elevate privileges for as little work as required and not for the whole plugin.
|Comment by Yehuda Hadad [ 14/May/18 ]|
The described behavior is Artifactory desired behavior, the function you have created not familiar with the "assystem" closure, and it is possible to use it only inside Artifactory's execution points (Download, Storage and etc).
|Comment by Krzysztof Malinowski [ 14/May/18 ]|
Fair enough. If that limitation is by design, please state it clearly in the documentation.
Still, you might want to reconsider it in future. When impossible to use asSystem within method, the only way is to run whole the code within asSystem block on the top-level, which impacts either security or code design (and maintainability).