public long getNumberOfAssignedIssues() throws Exception { if (assignedIssues == -1) { assignedIssues = userUtil.getNumberOfAssignedIssuesIgnoreSecurity(getLoggedInUser(), getUser()); } return assignedIssues; }
public MessageSet validate( final User searcher, final FunctionOperand functionOperand, final TerminalClause terminalClause) { final MessageSet messageSet; I18nHelper i18n = getI18n(); if (functionOperand.getArgs().size() == 0 && searcher == null) { messageSet = new MessageSetImpl(); messageSet.addErrorMessage( i18n.getText("jira.jql.function.anonymous.disallowed", getFunctionName())); } else { MessageSet messages = validateNumberOfArgs(functionOperand, i18n); if (!messages.hasAnyErrors()) { if (functionOperand.getArgs().size() == 1) { final String username = functionOperand.getArgs().get(0); if (userUtil.getUserObject(username) == null) { messages.addErrorMessage( i18n.getText(getUserNotFoundMessageKey(), functionOperand.getName(), username)); } } } return messages; } return messageSet; }
public Collection<ProjectComponent> getComponentsUserLeads() { if (componentsUserLeads == null) { componentsUserLeads = new ArrayList<ProjectComponent>(userUtil.getComponentsUserLeads(getUser())); } return componentsUserLeads; }
public long getNumberOfReportedIssues() throws Exception { if (reportedIssues == -1) { reportedIssues = userUtil.getNumberOfReportedIssuesIgnoreSecurity(getLoggedInUser(), getUser()); } return reportedIssues; }
public Collection<Project> getProjectsUserLeads(int limit) { if (projectsUserLeads == null) { projectsUserLeads = new ArrayList<Project>(userUtil.getProjectsLeadBy(getUser())); } if (limit == -1 || limit > projectsUserLeads.size()) { return projectsUserLeads; } else { return projectsUserLeads.subList(0, limit); } }
public ErrorCollection validateDetails(HandlerDetailsModel details) { final SimpleErrorCollection errorCollection = new SimpleErrorCollection(); final I18nHelper i18nHelper = authenticationContext.getI18nHelper(); if (details.isCreateusers()) { // Check that the default reporter is NOT configured // As if it is configured and creating users is set to true, // it is ambiguous whether to create a new user or use the default reporter final boolean extUserMgmt = !userManager.hasWritableDirectory(); if (StringUtils.isNotBlank(details.getReporterusername())) { if (extUserMgmt) { errorCollection.addError( "createusers", i18nHelper.getText("jmp.editHandlerDetails.error.external.user")); } else { errorCollection.addError( "reporterusername", i18nHelper.getText("jmp.editHandlerDetails.create.users.is.enabled")); } } else if (extUserMgmt) { errorCollection.addError( "createusers", i18nHelper.getText("jmp.editHandlerDetails.cant.create.users")); } } if (StringUtils.isNotBlank(details.getReporterusername()) && !userUtil.userExists(details.getReporterusername())) { errorCollection.addError( "reporterusername", i18nHelper.getText("admin.errors.users.user.does.not.exist")); } if (StringUtils.isNotBlank(details.getCatchemail()) && !TextUtils.verifyEmail(TextUtils.noNull(details.getCatchemail()).trim())) { errorCollection.addError("catchemail", i18nHelper.getText("admin.errors.invalid.email")); } if ("forward".equals(details.getBulk()) && StringUtils.isBlank(details.getForwardEmail())) { errorCollection.addError( "bulk", i18nHelper.getText("jmp.editHandlerDetails.forwardEmail.is.not.set")); } if (StringUtils.isNotBlank(details.getForwardEmail()) && !TextUtils.verifyEmail(TextUtils.noNull(details.getForwardEmail()).trim())) { errorCollection.addError("forwardEmail", i18nHelper.getText("admin.errors.invalid.email")); } return errorCollection; }
public List<QueryLiteral> getValues( final QueryCreationContext queryCreationContext, final FunctionOperand functionOperand, final TerminalClause terminalClause) { com.atlassian.jira.util.dbc.Assertions.notNull("queryCreationContext", queryCreationContext); User user; if (functionOperand.getArgs().size() == 1) { final String username = functionOperand.getArgs().get(0); user = userUtil.getUserObject(username); } else { user = queryCreationContext.getQueryUser(); } if (user == null) { return Collections.emptyList(); } return getFunctionValuesList(queryCreationContext, functionOperand, user); }
public boolean isNonSysAdminAttemptingToDeleteSysAdmin() { return userUtil.isNonSysAdminAttemptingToDeleteSysAdmin(getLoggedInUser(), getUser()); }