Examples of JiraAuthenticationContext


Examples of com.atlassian.jira.security.JiraAuthenticationContext

  public static String debugAction(ActionDescriptor action) {
    return action == null ? "<null>" : action.getName() + "(" + action.getId() + ")";
  }

  public static String getTextInCurrentUserLocale(String key, Object... parameters) {
    JiraAuthenticationContext context = ComponentAccessor.getJiraAuthenticationContext();
    if (context == null) logger.warn("No JIRA auth context: maybe it is a plugin system 2 plugin now? Text will be formatted in the JIRA default locale.");
    User user = context == null ? null : context.getLoggedInUser();
    return getText(null, user, key, parameters);
  }
View Full Code Here

Examples of com.atlassian.jira.security.JiraAuthenticationContext

  public static String debugAction(ActionDescriptor action) {
    return action == null ? "<null>" : action.getName() + "(" + action.getId() + ")";
  }

  public static String getTextInCurrentUserLocale(String key, Object... parameters) {
    JiraAuthenticationContext context = ComponentAccessor.getJiraAuthenticationContext();
    if (context == null) logger.warn("No JIRA auth context: maybe it is a plugin system 2 plugin now? Text will be formatted in the JIRA default locale.");
    User user = context == null ? null : context.getLoggedInUser();
    return getText(null, user, key, parameters);
  }
View Full Code Here

Examples of com.atlassian.jira.security.JiraAuthenticationContext

  public static String debugAction(ActionDescriptor action) {
    return action == null ? "<null>" : action.getName() + "(" + action.getId() + ")";
  }

  public static String getTextInCurrentUserLocale(String key, Object... parameters) {
    JiraAuthenticationContext context = ComponentAccessor.getJiraAuthenticationContext();
    if (context == null) logger.warn("No JIRA auth context: maybe it is a plugin system 2 plugin now? Text will be formatted in the JIRA default locale.");
    User user = context == null ? null : context.getLoggedInUser();
    return getText(null, user, key, parameters);
  }
View Full Code Here

Examples of com.atlassian.jira.security.JiraAuthenticationContext

    @POST
    @Path("/initjqldlg")
    @Produces({MediaType.APPLICATION_JSON})
    public Response initJqlDialog(@Context HttpServletRequest req)
    {
        JiraAuthenticationContext authCtx = ComponentManager.getInstance().getJiraAuthenticationContext();
        I18nHelper i18n = authCtx.getI18nHelper();
        User user = authCtx.getLoggedInUser();
        if (user == null)
        {
            log.error("QueryFieldsService::initJclDialog - User is not logged");
            return Response.ok(i18n.getText("queryfields.error.notlogged")).status(401).build();
        }

        String cfIdStr = req.getParameter("cfId");
        String prIdStr = req.getParameter("prId");
        String type = req.getParameter("type");
        if (!Utils.isValidStr(cfIdStr) || !Utils.isValidStr(prIdStr) || !Utils.isValidStr(type))
        {
            log.error("QueryFieldsService::initJclDialog - Required parameters are not set");
            return Response.ok(i18n.getText("queryfields.error.notrequiredparms")).status(500).build();
        }

        long cfId;
        long prId;
        try
        {
            cfId = Long.parseLong(cfIdStr);
            prId = Long.parseLong(prIdStr);
        }
        catch (NumberFormatException nex)
        {
            log.error("QueryFieldsService::initJclDialog - Parameters are not valid");
            return Response.ok(i18n.getText("queryfields.error.notvalidparms")).status(500).build();
        }

        XsrfTokenGenerator xsrfTokenGenerator = ComponentManager.getComponentInstanceOfType(XsrfTokenGenerator.class);
        String atl_token = xsrfTokenGenerator.generateToken(req);

        Map<String, Object> params = new HashMap<String, Object>();
        params.put("i18n", authCtx.getI18nHelper());
        params.put("baseUrl", Utils.getBaseUrl(req));
        params.put("atl_token", atl_token);
        params.put("cfId", cfId);
        params.put("prId", prId);
        params.put("type", type);
View Full Code Here

Examples of com.atlassian.jira.security.JiraAuthenticationContext

    @POST
    @Path("/setjql")
    @Produces({MediaType.APPLICATION_JSON})
    public Response setJcl(@Context HttpServletRequest req)
    {
        JiraAuthenticationContext authCtx = ComponentManager.getInstance().getJiraAuthenticationContext();
        I18nHelper i18n = authCtx.getI18nHelper();
        User user = authCtx.getLoggedInUser();
        if (user == null)
        {
            log.error("QueryFieldsService::setJcl - User is not logged");
            return Response.ok(i18n.getText("queryfields.error.notlogged")).status(401).build();
        }
View Full Code Here

Examples of com.atlassian.jira.security.JiraAuthenticationContext

        ErrorCollection errorCollection, FieldConfig fieldConfig)
    {
        @SuppressWarnings("unchecked")
        final Collection<String> params = cfParams.getAllValues();
        CustomField cf = fieldConfig.getCustomField();
        JiraAuthenticationContext authCtx = ComponentManager.getInstance()
            .getJiraAuthenticationContext();
        I18nHelper i18n = authCtx.getI18nHelper();
        UserProjectHistoryManager userProjectHistoryManager = ComponentManager
            .getComponentInstanceOfType(UserProjectHistoryManager.class);
        Project currentProject = userProjectHistoryManager.getCurrentProject(
            Permissions.BROWSE, authCtx.getLoggedInUser());

        boolean isAutocompleteView;
        if (cf.isAllProjects())
        {
            isAutocompleteView = qfMgr.isAutocompleteView(cf.getIdAsLong(),
View Full Code Here

Examples of com.atlassian.jira.security.JiraAuthenticationContext

    @POST
    @Path("/getcfvals")
    @Produces({MediaType.APPLICATION_JSON})
    public Response getCfVals(@Context HttpServletRequest req)
    {
        JiraAuthenticationContext authCtx = ComponentManager.getInstance()
            .getJiraAuthenticationContext();
        I18nHelper i18n = authCtx.getI18nHelper();
        User user = authCtx.getLoggedInUser();
        if (user == null)
        {
            log.error("QueryAutocompleteService::getCfVals - User is not logged");
            return Response
                .ok(i18n.getText("queryfields.service.user.notlogged"))
                .status(401).build();
        }

        String cfId = req.getParameter("cf_id");

        AutocompleteUniversalData data;
        List<AutocompleteUniversalData> values = null;

        if (Utils.isValidStr(cfId))
        {
            CustomField cf = ComponentManager.getInstance()
                .getCustomFieldManager().getCustomFieldObject(cfId);
            if (cf == null)
            {
                log.error("QueryAutocompleteService::getCfVals - Custom field is null. Incorrect data in plugin settings");
                return Response
                    .ok(i18n.getText("queryfields.service.error.cfid.invalid"))
                    .status(400).build();
            }

            String jqlData;
            if (cf.isAllProjects())
            {
                jqlData = qfMgr.getQueryFieldData(cf.getIdAsLong(),
                    Consts.PROJECT_ID_FOR_GLOBAL_CF);
            }
            else
            {
                UserProjectHistoryManager userProjectHistoryManager = ComponentManager
                    .getComponentInstanceOfType(UserProjectHistoryManager.class);
                Project currentProject = userProjectHistoryManager
                    .getCurrentProject(Permissions.BROWSE,
                        authCtx.getLoggedInUser());
                if (currentProject == null)
                {
                    log.error("QueryAutocompleteService::getCfVals - Current project is null");
                    return Response
                        .ok(i18n.getText("queryfields.service.error.curproject"))
View Full Code Here

Examples of com.atlassian.jira.security.JiraAuthenticationContext

    @POST
    @Path("/getissuetemplate")
    @Produces({MediaType.APPLICATION_JSON})
    public Response getIssueTemplate(@Context HttpServletRequest req)
    {
        JiraAuthenticationContext authCtx = ComponentManager.getInstance()
            .getJiraAuthenticationContext();
        I18nHelper i18n = authCtx.getI18nHelper();
        User user = authCtx.getLoggedInUser();
        if (user == null)
        {
            log.error("QueryAutocompleteService::validateInput - User is not logged");
            return Response
                .ok(i18n.getText("queryfields.service.user.notlogged"))
View Full Code Here

Examples of com.atlassian.jira.security.JiraAuthenticationContext

  public static String debugAction(ActionDescriptor action) {
    return action == null ? "<null>" : action.getName() + "(" + action.getId() + ")";
  }

  public static String getTextInCurrentUserLocale(String key, Object... parameters) {
    JiraAuthenticationContext context = ComponentAccessor.getJiraAuthenticationContext();
    if (context == null) logger.warn("No JIRA auth context: maybe it is a plugin system 2 plugin now? Text will be formatted in the JIRA default locale.");
    User user = context == null ? null : context.getLoggedInUser();
    return getText(null, user, key, parameters);
  }
View Full Code Here

Examples of com.atlassian.jira.security.JiraAuthenticationContext

  public static String debugAction(ActionDescriptor action) {
    return action == null ? "<null>" : action.getName() + "(" + action.getId() + ")";
  }

  public static String getTextInCurrentUserLocale(String key, Object... parameters) {
    JiraAuthenticationContext context = ComponentAccessor.getJiraAuthenticationContext();
    if (context == null) logger.warn("No JIRA auth context: maybe it is a plugin system 2 plugin now? Text will be formatted in the JIRA default locale.");
    User user = context == null ? null : context.getLoggedInUser();
    return getText(null, user, key, parameters);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.