Please, consider adding access to ComponentManager via parameter within velocity script.
Now I need to use separate plugin that expose ComponentManager via CustomField.
I understood that it is too risky. May be you can add separate Calc. Custom Field that will expose ComponentManager.
I have to think about it
My usages of ComponentManager are
set($ps = $cmpMgr.getUserPropertyManager().getPropertySet($reporter)) - to take User properties
$cmpMgr.getJiraAuthenticationContext().getLoggedInUser().name - get current Jira username
$cmpMgr.getCrowdService().isUserMemberOfGroup($reporter.name,"sphere-employees") - detect if come user is member of group
I will try to perform admin task by componentManager under non-admin user - as I understood it must fail because $cmpMgr.getJiraAuthenticationContext() is current user - not Admin user
Sorry, too dangerous for the std. usage.
Build and install a Plugin which uses the JIRA Metadata Plugin. See Sample Code:
(The Sample Plugin was build with Eclipse, https://developer.atlassian.com/display/DOCS/Installing+the+Atlassian+Plugin+SDK and JIRA 5.0)