com.atlassian.jira.user.ApplicationUser Java Examples
The following examples show how to use
com.atlassian.jira.user.ApplicationUser.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SessionAction.java From planning-poker-plugin with MIT License | 6 votes |
public void sendEmailToNotifyUsers() throws Exception { for (ApplicationUser user : parseNotifyUserList()) { Email em = new Email(user.getEmailAddress()); em.setSubject("New planning poker session has been created for issue " + getIssueObject().getKey() + "."); StringWriter body = new StringWriter(); Map<String, Object> context = Maps.newHashMap(); context.put("issue", getIssueObject()); String baseUrl = getHttpRequest().getRequestURL().toString() .replaceAll(getHttpRequest().getServletPath(), ""); context.put("baseUrl", baseUrl); templateRenderer.render("views/emails/notify.vm", context, body); em.setBody(body.toString()); em.setMimeType("text/html"); SingleMailQueueItem smqi = new SingleMailQueueItem(em); ComponentAccessor.getMailQueue().addItem(smqi); } }
Example #2
Source File: SessionAction.java From planning-poker-plugin with MIT License | 6 votes |
public List<ApplicationUser> parseNotifyUserList() { if (parsedNotifyUserList != null) { return parsedNotifyUserList; } List<ApplicationUser> result = new ArrayList<ApplicationUser>(); if (!"".equals(getNotifyUserList())) { String[] rawResult = getNotifyUserList().split(","); for (String rawUser : rawResult) { ApplicationUser user = getUserManager().getUserByName(rawUser.trim()); if (user == null) { throw new UserNotFoundException(rawUser); } result.add(user); } } parsedNotifyUserList = result; return result; }
Example #3
Source File: RestResource.java From jira-groovioli with BSD 2-Clause "Simplified" License | 6 votes |
@Path("/getscript") @GET @Produces({MediaType.TEXT_PLAIN}) public Response getScript(@QueryParam("restDataId") Integer restDataId) { ApplicationUser currentUser = jiraAuthenticationContext.getLoggedInUser(); if (!globalPermissionManager.hasPermission(ADMINISTER, currentUser)) { log.warn("Invalid user:{} tries to access script", currentUser.getName()); return status(FORBIDDEN) .entity(jiraAuthenticationContext.getI18nHelper().getText("groovioli-rest.rest.noaccess")) .build(); } RestData restData = restDataManager.get(restDataId); if (restData == null) { return status(NOT_FOUND) .entity(jiraAuthenticationContext.getI18nHelper().getText("groovioli-rest.rest.norest")) .build(); } return status(OK).entity(restData.getScript()).build(); }
Example #4
Source File: ListenerResource.java From jira-groovioli with BSD 2-Clause "Simplified" License | 6 votes |
@Path("/getscript") @GET @Produces({MediaType.TEXT_PLAIN}) public Response getScript(@QueryParam("listenerId") Integer listenerId) { ApplicationUser currentUser = jiraAuthenticationContext.getLoggedInUser(); if (!globalPermissionManager.hasPermission(ADMINISTER, currentUser)) { log.warn("Invalid user:{} tries to access script", currentUser.getName()); return status(FORBIDDEN) .entity(jiraAuthenticationContext.getI18nHelper().getText("groovioli-rest.listener.noaccess")) .build(); } ListenerData listenerData = listenerDataManager.get(listenerId); if (listenerData == null) { return status(NOT_FOUND) .entity(jiraAuthenticationContext.getI18nHelper().getText("groovioli-rest.listener.nolistener")) .build(); } return status(OK).entity(listenerData.getScript()).build(); }
Example #5
Source File: ListenersAddAction.java From jira-groovioli with BSD 2-Clause "Simplified" License | 5 votes |
private boolean hasAdminPermission() { ApplicationUser applicationUser = getLoggedInUser(); if (applicationUser != null) { return getGlobalPermissionManager().hasPermission(ADMINISTER, applicationUser); } return false; }
Example #6
Source File: VoteService.java From planning-poker-plugin with MIT License | 5 votes |
public List<ApplicationUser> getVotersBySession(Session session) { String issueStoreKey = getIssueStoreKey(session.getIssue()); List<String> votersRaw = getList(issueStoreKey + ".voters"); List<ApplicationUser> voters = new ArrayList<ApplicationUser>(); for (String voterRaw : votersRaw) { ApplicationUser voter = userManager.getUserByKey(voterRaw); voters.add(voter); } return voters; }
Example #7
Source File: RestsSetupAction.java From jira-groovioli with BSD 2-Clause "Simplified" License | 5 votes |
private boolean hasAdminPermission() { ApplicationUser applicationUser = getLoggedInUser(); if (applicationUser != null) { return getGlobalPermissionManager().hasPermission(ADMINISTER, applicationUser); } return false; }
Example #8
Source File: ListenersSetupAction.java From jira-groovioli with BSD 2-Clause "Simplified" License | 5 votes |
private boolean hasAdminPermission() { ApplicationUser applicationUser = getLoggedInUser(); if (applicationUser != null) { return getGlobalPermissionManager().hasPermission(ADMINISTER, applicationUser); } return false; }
Example #9
Source File: ListenersDeleteAction.java From jira-groovioli with BSD 2-Clause "Simplified" License | 5 votes |
private boolean hasAdminPermission() { ApplicationUser applicationUser = getLoggedInUser(); if (applicationUser != null) { return getGlobalPermissionManager().hasPermission(ADMINISTER, applicationUser); } return false; }
Example #10
Source File: RestsAddAction.java From jira-groovioli with BSD 2-Clause "Simplified" License | 5 votes |
private boolean hasAdminPermission() { ApplicationUser applicationUser = getLoggedInUser(); if (applicationUser != null) { return getGlobalPermissionManager().hasPermission(ADMINISTER, applicationUser); } return false; }
Example #11
Source File: RestsDeleteAction.java From jira-groovioli with BSD 2-Clause "Simplified" License | 5 votes |
private boolean hasAdminPermission() { ApplicationUser applicationUser = getLoggedInUser(); if (applicationUser != null) { return getGlobalPermissionManager().hasPermission(ADMINISTER, applicationUser); } return false; }
Example #12
Source File: SecureTokenConfigAction.java From jira-prometheus-exporter with BSD 2-Clause "Simplified" License | 5 votes |
public boolean hasAdminPermission() { ApplicationUser user = getLoggedInUser(); if (user == null) { return false; } return globalPermissionManager.hasPermission(GlobalPermissionKey.ADMINISTER, user); }
Example #13
Source File: VoteAction.java From planning-poker-plugin with MIT License | 4 votes |
public List<ApplicationUser> getVoters() { Session session = getSessionObject(); return voteService.getVotersBySession(session); }
Example #14
Source File: Vote.java From planning-poker-plugin with MIT License | 4 votes |
public void setVoter(ApplicationUser voter) { this.voter = voter; }
Example #15
Source File: Vote.java From planning-poker-plugin with MIT License | 4 votes |
public ApplicationUser getVoter() { return voter; }
Example #16
Source File: VoteService.java From planning-poker-plugin with MIT License | 4 votes |
public String getVoteComment(Session session, ApplicationUser user) { return (String) pluginSettings.get(getIssueStoreKey(session.getIssue()) + "." + user.getKey() + ".comment"); }
Example #17
Source File: VoteService.java From planning-poker-plugin with MIT License | 4 votes |
public String getVoteVal(Session session, ApplicationUser user) { return (String) pluginSettings.get(getIssueStoreKey(session.getIssue()) + "." + user.getKey()); }
Example #18
Source File: Session.java From planning-poker-plugin with MIT License | 4 votes |
public ApplicationUser getAuthor() { return author; }
Example #19
Source File: VoteService.java From planning-poker-plugin with MIT License | 4 votes |
public boolean isVoter(Session session, ApplicationUser user) { return getVoteVal(session, user) != null; }
Example #20
Source File: Session.java From planning-poker-plugin with MIT License | 4 votes |
public void setAuthor(ApplicationUser author) { this.author = author; }
Example #21
Source File: PlanningPokerPanel.java From planning-poker-plugin with MIT License | 4 votes |
public String getAvatarURL(ApplicationUser user) { return avatarService.getAvatarUrlNoPermCheck(user, Avatar.Size.NORMAL).toString(); }
Example #22
Source File: SessionAction.java From planning-poker-plugin with MIT License | 4 votes |
private ApplicationUser getCurrentUser() { return authContext.getUser(); }
Example #23
Source File: VoteAction.java From planning-poker-plugin with MIT License | 4 votes |
private ApplicationUser getCurrentUser() { return authContext.getUser(); }
Example #24
Source File: MetricListener.java From jira-prometheus-exporter with BSD 2-Clause "Simplified" License | 4 votes |
@EventListener public void onLoginEvent(LoginEvent loginEvent) { ApplicationUser applicationUser = loginEvent.getUser(); metricCollector.userLoginCounter((applicationUser != null) ? applicationUser.getUsername() : ""); }
Example #25
Source File: VoteAction.java From planning-poker-plugin with MIT License | 4 votes |
public String getAvatarURL(ApplicationUser user) { return avatarService.getAvatarUrlNoPermCheck(user, Avatar.Size.NORMAL).toString(); }
Example #26
Source File: VoteAction.java From planning-poker-plugin with MIT License | 4 votes |
public String getUserHtml(ApplicationUser user) { Map<String, Object> params = Maps.newHashMap(); params.put("avatarURL", getAvatarURL(user)); UserFormatter userFormatter = userFormats.formatter("avatarFullNameHover"); return userFormatter.formatUserkey(user.getKey(), "poker-author", params); }
Example #27
Source File: HttpHandlerServlet.java From jira-groovioli with BSD 2-Clause "Simplified" License | 4 votes |
@Override protected void service( HttpServletRequest req, HttpServletResponse resp) throws IOException { String path = req.getPathInfo(); String[] pathParts = split(path, '/'); if (ArrayUtils.isEmpty(pathParts)) { resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "At least one path after /groovioli should be set"); return; } RestData restData = restDataManager.getByPath(pathParts[0]); if (restData == null) { resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "No action for current path was found"); return; } if (StringUtils.isBlank(restData.getPerformer())) { if (!jiraAuthenticationContext.isLoggedInUser()) { resp.sendError(HttpServletResponse.SC_UNAUTHORIZED, "User should be authorized for this action"); return; } } else { ApplicationUser performerUser = userUtil.getUserByName(restData.getPerformer()); if (performerUser == null) { resp.sendError(HttpServletResponse.SC_FORBIDDEN, "Performer user is not found for this action"); return; } jiraAuthenticationContext.setLoggedInUser(performerUser); } // headers Map<String, List<String>> headers = new HashMap<>(); Enumeration<String> headerNames = req.getHeaderNames(); while (headerNames.hasMoreElements()) { String headerName = headerNames.nextElement(); List<String> value = new ArrayList<>(); headers.put(headerName, value); Enumeration<String> headerValues = req.getHeaders(headerName); while (headerValues.hasMoreElements()) { value.add(headerValues.nextElement()); } } Map<String, Object> parameters = new HashMap<>(); parameters.put("httpMethod", req.getMethod()); parameters.put("httpPath", path); parameters.put("httpContentType", req.getContentType()); parameters.put("httpHeaders", headers); parameters.put("httpRemoteAddr", req.getRemoteAddr()); parameters.put("httpParameterMap", req.getParameterMap()); parameters.put("httpPayload", inputStreamToString(req.getInputStream())); parameters.put("performerUser", jiraAuthenticationContext.getLoggedInUser()); try { scriptManager.executeScript(restData.getScript(), parameters); } catch (ScriptException e) { log.error("Error executing HTTP handler script for path:{}", restData.getPath(), e); resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } resp.setStatus(HttpServletResponse.SC_OK); }
Example #28
Source File: MetricListener.java From jira-prometheus-exporter with BSD 2-Clause "Simplified" License | 4 votes |
@EventListener public void onLogoutEvent(LogoutEvent logoutEvent) { ApplicationUser applicationUser = logoutEvent.getUser(); metricCollector.userLogoutCounter((applicationUser != null) ? applicationUser.getUsername() : ""); }