Jira Plugin user specific settings

时间:2015-10-30 22:29:17

标签: jira jira-plugin

I've just started writing my first JIRA plugin and I need to implement some user specific settings, like the ones returned by this:

select * from jiraschema.propertyentry where ENTITY_NAME = 'ApplicationUser'

For now I was able to save only global settings for the plugin using PluginSettingsFactory, but I need to have different settings for each user. Does anyone know how to implement such a thing?

Thank you.

1 个答案:

答案 0 :(得分:2)

我找到了访问ApplicationUser属性的解决方案。这是我的方法,也许它有助于某人:

    UserPropertyManager userPropertyManager = ComponentAccessor.getUserPropertyManager();
    String propValue = null;

    //get a user specific property
    propValue = userPropertyManager.getPropertySet(ComponentAccessor.getJiraAuthenticationContext().getUser()).getAsActualType("workflow-mode").toString();

    //set a new user specific prop
    ComponentAccessor.getUserPropertyManager().getPropertySet(ComponentAccessor.getJiraAuthenticationContext().getUser()).setString("my_new_prop_name", "my_new_prop_value");