-
Suggestion
-
Resolution: Answered
-
None
-
None
I have modified my JiraVelocityUtils.class and it run very good in my version 3.13.5
But in my work we have the version is 3.13.2 and dont work the code in my custom filed VelocityMessage(for edit)is:
#set ( $allowed = false )
#set ( $inicia = 0 )
#set ( $pid = $requestContext.getRequestParameter("pid") )
#if ( $pid )
#set ( $roles = ["Administrators","Developers","Release Managers","Users"] )
#foreach ( $prj in $componentManager.getProjectManager().getProjects() )
#if ( $prj.id == $prj.id.parseLong($pid) )
#set ( $project = $componentManager.getProjectManager().getProjectObj($prj.id) )
#end
#end
#foreach ( $rol in $roles )
#set ( $role = $projectRoleManager.getProjectRole($rol) )
$rol
#set ( $allowed=$projectRoleManager.isUserInProjectRole($authcontext.user, $role, $project))
#if ( $allowed )
#set ( $inicia=1 )
#end
#end
#end
<div class="warningBox">
$inicia
</div>
And My JiraVelocityUtils.java for 3.13.5 is:
package com.atlassian.jira.util;
import com.atlassian.core.util.DateUtils;
import com.atlassian.core.util.XMLUtils;
import com.atlassian.core.util.map.EasyMap;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.mail.JiraMailQueueUtils;
import com.atlassian.jira.plugin.profile.UserFormatManager;
import com.atlassian.jira.security.JiraAuthenticationContext;
import com.atlassian.jira.security.roles.ProjectRoleManager;
import com.atlassian.jira.util.velocity.VelocityRequestContext;
import com.atlassian.jira.util.velocity.VelocityRequestContextFactory;
import com.atlassian.jira.web.bean.I18nBean;
import com.atlassian.jira.web.bean.PermissionCheckBean;
import com.atlassian.jira.web.util.ExternalLinkUtilImpl;
import com.opensymphony.util.TextUtils;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
import webwork.action.ActionContext;
// Referenced classes of package com.atlassian.jira.util:
// JiraUrlCodec, JiraWebUtils
public class JiraVelocityUtils
{
public JiraVelocityUtils()
{
}
public static Map getDefaultVelocityParams(JiraAuthenticationContext authenticationContext)
{ return getDefaultVelocityParams(null, authenticationContext); } public static Map getDefaultVelocityParams(Map startingParams, JiraAuthenticationContext authenticationContext)
{
Map velocityParams = new HashMap();
try
{
velocityParams.put("xmlutils", new XMLUtils());
velocityParams.put("textutils", new TextUtils());
velocityParams.put("urlcodec", new JiraUrlCodec());
velocityParams.put("outlookdate", authenticationContext.getOutlookDate());
velocityParams.put("authcontext", authenticationContext);
velocityParams.put("dateutils", new DateUtils(authenticationContext.getI18nBean().getDefaultResourceBundle()));
velocityParams.put("externalLinkUtil", ExternalLinkUtilImpl.getInstance());
VelocityRequestContext velocityRequestContext = (new VelocityRequestContextFactory(ComponentManager.getInstance().getApplicationProperties())).getJiraVelocityRequestContext();
velocityParams.put("requestContext", velocityRequestContext);
velocityParams.put("baseurl", velocityRequestContext.getBaseUrl());
velocityParams.put("webResourceManager", ComponentManager.getInstance().getWebResourceManager());
*************************************************************
*************************************************************
*************************************************************
here is where dont work in 3.13.2 : this line is added for me
velocityParams.put("componentManager", ComponentManager.getInstance());
velocityParams.put("projectRoleManager", ComponentManager.getComponentInstanceOfType(com/atlassian/jira/security/roles/ProjectRoleManager));
****************************************
****************************************
****************************************
UserFormatManager userFormatManager = (UserFormatManager)ComponentManager.getComponentInstanceOfType(com/atlassian/jira/plugin/profile/UserFormatManager);
velocityParams.put("userformat", userFormatManager);
velocityParams.put("map", new EasyMap());
velocityParams.put("permissionCheck", new PermissionCheckBean(authenticationContext, ComponentManager.getInstance().getPermissionManager()));
if(ActionContext.getRequest() != null)
}
catch(Exception e)
JiraMailQueueUtils.getContextParamsBody(velocityParams);
if(startingParams != null)
velocityParams.putAll(startingParams);
return velocityParams;
}
public static final Logger log = Logger.getLogger(com/atlassian/jira/util/JiraVelocityUtils);
}
- was split into
-
CONFSERVER-39825 Quartz scheduled jobs can stop running until restart
- Closed