/** * @param user The user this event refers to */ public UserEvent(ApplicationUser user, int eventType) { super(); this.user = user; this.eventType = eventType; JiraAuthenticationContext authenticationContext = ComponentAccessor.getComponentOfType(JiraAuthenticationContext.class); this.initiatingUser = authenticationContext.getUser(); }
@Override public boolean shouldDisplay(final Map<String, Object> context) { final ApplicationUser user = authenticationContext.getLoggedInUser(); return user != null && permissionManager.hasPermission(GlobalPermissionKey.ADMINISTER, user); } }
@Override public DraftWorkflowSchemeMigrationHelper createMigrationHelper(Project triggerProject, List<Project> projects, DraftWorkflowScheme draft) throws GenericEntityException { Preconditions.checkNotNull(projects, "projects cannot be null."); return new DraftWorkflowSchemeMigrationHelper(triggerProject, projects, draft, workflowManager, delegator, schemeManager, authCtx.getI18nHelper(), authCtx.getUser(), constantsManager, taskManager, issueIndexManager, workflowSchemeManager, eventPublisher); } }
/** * Constructor. * @param field Field the handler is for. * * @deprecated @since 5.0-RC2 Use the constructor {@link #AbstractCustomFieldOperationsHandler(CustomField field, I18nHelper i18nHelper)} */ public AbstractCustomFieldOperationsHandler(CustomField field) { this.field = field; i18nHelper = ComponentAccessor.getJiraAuthenticationContext().getI18nHelper(); }
private <T> ServiceOutcome<T> validatePermission() { if (!permissionManager.hasPermission(GlobalPermissionKey.ADMINISTER, ctx.getLoggedInUser())) { return ServiceOutcomeImpl.error(ctx.getI18nHelper().getText("application.role.service.permission.denied"), ErrorCollection.Reason.FORBIDDEN); } else { return ServiceOutcomeImpl.ok(null); } }
@Override public Locale getLocale() { return jiraAuthenticationContext.getLocale(); }
private void preCall(final ApplicationUser runAsUser) { JiraThreadLocalUtils.preCall(); jiraAuthenticationContext.setLoggedInUser(runAsUser); }
@Override public boolean shouldDisplay(final Map<String, Object> context) { return !authenticationContext.isLoggedInUser(); } }
protected I18nHelper getI18NBean() { return ComponentAccessor.getJiraAuthenticationContext().getI18nHelper(); } }
/** Retrieve name translation in current locale */ public String getNameTranslation() { return nameTranslations.getUnchecked(authenticationContext.getLocale().toString()); }
private void postCall(final Runnable command) { jiraAuthenticationContext.setLoggedInUser((ApplicationUser) null); JiraThreadLocalUtils.postCall(log, new JiraThreadLocalUtil.WarningCallback() { @Override public void onOpenTransaction() { log.error("A database connection was left open by the code : " + command.getClass().getName()); } }); }
/** * @param params Parameters retrieved by the Listener * @param user The user this event refers to */ public UserEvent(Map<String,Object> params, ApplicationUser user, int eventType) { super(params); this.user = user; this.eventType = eventType; JiraAuthenticationContext authenticationContext = ComponentAccessor.getComponentOfType(JiraAuthenticationContext.class); this.initiatingUser = authenticationContext.getUser(); }
@Override public DefaultRoleActors getDefaultRoleActors(ProjectRole projectRole, ErrorCollection errorCollection) { return getDefaultRoleActors(jiraAuthenticationContext.getLoggedInUser(), projectRole, errorCollection); }
@Override public AssignableWorkflowSchemeMigrationHelper createMigrationHelper(Project project, AssignableWorkflowScheme scheme) throws GenericEntityException { Preconditions.checkNotNull(project, "project cannot be null."); return new AssignableWorkflowSchemeMigrationHelper(project, scheme, workflowManager, delegator, schemeManager, authCtx.getI18nHelper(), authCtx.getUser(), constantsManager, taskManager, getIssueManager(), issueIndexManager, workflowSchemeManager, eventPublisher); }
@VisibleForTesting I18nHelper getI18nBean() { return ComponentAccessor.getJiraAuthenticationContext().getI18nHelper(); }
/** Retrieve desc translation in current locale */ public String getDescTranslation() { return descriptionTranslations.getUnchecked(authenticationContext.getLocale().toString()); }
private void preCallSetup() { JiraThreadLocalUtils.preCall(); ApplicationUser user = userManager.getUserByName(taskDescriptor.getUserName()); context.setLoggedInUser(user); }
/** * @deprecated Use {@link #createBean(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.user.ApplicationUser)} */ @Override @Deprecated public UserJsonBean createBean(ApplicationUser createdUser) { return createBean(createdUser, ComponentAccessor.getComponent(JiraAuthenticationContext.class).getUser()); }
@Override public void addDefaultActorsToProjectRole(final ApplicationUser currentUser, final Collection<String> actors, final ProjectRole projectRole, final String type, final ErrorCollection errorCollection) { updateActorsToDefaultRole(jiraAuthenticationContext.getLoggedInUser(), actors, projectRole, type, errorCollection, true); }
private JiraServiceContext createServiceContext() { return new JiraServiceContextImpl(authenticationContext.getUser(), new SimpleErrorCollection(), authenticationContext.getI18nHelper()); }