|
3 | 3 | */
|
4 | 4 | package com.topcoder.direct.services.view.action.contest.launch;
|
5 | 5 |
|
6 |
| -import java.util.ArrayList; |
7 |
| -import java.util.Arrays; |
8 |
| -import java.util.HashMap; |
9 |
| -import java.util.List; |
10 |
| -import java.util.Map; |
11 |
| - |
12 | 6 | import com.topcoder.clients.model.Project;
|
13 | 7 | import com.topcoder.clients.model.ProjectContestFee;
|
14 | 8 | import com.topcoder.clients.model.ProjectContestFeePercentage;
|
15 |
| -import com.topcoder.direct.services.configs.AlgorithmSubtypeContestFee; |
16 | 9 | import com.topcoder.direct.services.configs.ConfigUtils;
|
17 |
| -import com.topcoder.direct.services.configs.ContestFee; |
18 |
| -import com.topcoder.direct.services.configs.StudioSubtypeContestFee; |
19 | 10 | import com.topcoder.direct.services.project.metadata.entities.dao.DirectProjectAccess;
|
20 | 11 | import com.topcoder.direct.services.project.milestone.model.Milestone;
|
21 | 12 | import com.topcoder.direct.services.project.milestone.model.MilestoneStatus;
|
|
24 | 15 | import com.topcoder.direct.services.view.dto.IdNamePair;
|
25 | 16 | import com.topcoder.direct.services.view.dto.contest.ContestCopilotDTO;
|
26 | 17 | import com.topcoder.direct.services.view.dto.contest.ProblemDTO;
|
27 |
| -import com.topcoder.direct.services.view.dto.contest.TypedContestBriefDTO; |
28 | 18 | import com.topcoder.direct.services.view.dto.contest.ReviewScorecardDTO;
|
| 19 | +import com.topcoder.direct.services.view.dto.contest.TypedContestBriefDTO; |
29 | 20 | import com.topcoder.direct.services.view.util.AuthorizationProvider;
|
30 | 21 | import com.topcoder.direct.services.view.util.DataProvider;
|
31 | 22 | import com.topcoder.direct.services.view.util.DirectUtils;
|
| 23 | +import com.topcoder.direct.services.view.util.JwtTokenUpdater; |
32 | 24 | import com.topcoder.direct.services.view.util.challenge.CostCalculationService;
|
| 25 | +import com.topcoder.management.project.ProjectGroup; |
33 | 26 | import com.topcoder.security.TCSubject;
|
34 | 27 | import com.topcoder.service.facade.contest.ContestServiceException;
|
35 | 28 | import com.topcoder.service.facade.project.DAOFault;
|
36 | 29 | import org.apache.commons.lang3.StringEscapeUtils;
|
37 | 30 | import org.codehaus.jackson.map.ObjectMapper;
|
38 |
| -import com.topcoder.management.project.ProjectGroup; |
| 31 | + |
| 32 | +import java.util.*; |
39 | 33 |
|
40 | 34 | /**
|
41 | 35 | * <p>
|
@@ -130,6 +124,13 @@ public class CommonAction extends BaseContestFeeAction {
|
130 | 124 |
|
131 | 125 | private long categoryId;
|
132 | 126 |
|
| 127 | + /** |
| 128 | + * Endpoint to group of a user |
| 129 | + */ |
| 130 | + private String userGroupsApiEndpoint; |
| 131 | + |
| 132 | + private JwtTokenUpdater jwtTokenUpdater; |
| 133 | + |
133 | 134 | /**
|
134 | 135 | * <p>
|
135 | 136 | * Executes the action.
|
@@ -325,7 +326,6 @@ public String getContestConfigs() throws Exception {
|
325 | 326 |
|
326 | 327 | configs.put("copilotFees", ConfigUtils.getCopilotFees());
|
327 | 328 | configs.put("billingInfos", getBillingProjectInfos());
|
328 |
| - configs.put("groups", getAllProjectGroups()); |
329 | 329 | configs.put("platforms", getReferenceDataBean().getPlatforms());
|
330 | 330 | configs.put("technologies", getReferenceDataBean().getTechnologies());
|
331 | 331 | setResult(configs);
|
@@ -552,4 +552,38 @@ public long getCategoryId() {
|
552 | 552 | public void setCategoryId(long categoryId) {
|
553 | 553 | this.categoryId = categoryId;
|
554 | 554 | }
|
| 555 | + |
| 556 | + /** |
| 557 | + * Get Accessible security groups from group Api |
| 558 | + * |
| 559 | + * @return |
| 560 | + */ |
| 561 | + public String getGroups() { |
| 562 | + try { |
| 563 | + TCSubject tcSubject = DirectUtils.getTCSubjectFromSession(); |
| 564 | + Set<ProjectGroup> projectGroups = DirectUtils.getGroups(tcSubject, jwtTokenUpdater, userGroupsApiEndpoint); |
| 565 | + setResult(projectGroups); |
| 566 | + } catch (Throwable e) { |
| 567 | + if (getModel() != null) { |
| 568 | + setResult(e); |
| 569 | + } |
| 570 | + } |
| 571 | + return SUCCESS; |
| 572 | + } |
| 573 | + |
| 574 | + public String getUserGroupsApiEndpoint() { |
| 575 | + return userGroupsApiEndpoint; |
| 576 | + } |
| 577 | + |
| 578 | + public void setUserGroupsApiEndpoint(String userGroupsApiEndpoint) { |
| 579 | + this.userGroupsApiEndpoint = userGroupsApiEndpoint; |
| 580 | + } |
| 581 | + |
| 582 | + public JwtTokenUpdater getJwtTokenUpdater() { |
| 583 | + return jwtTokenUpdater; |
| 584 | + } |
| 585 | + |
| 586 | + public void setJwtTokenUpdater(JwtTokenUpdater jwtTokenUpdater) { |
| 587 | + this.jwtTokenUpdater = jwtTokenUpdater; |
| 588 | + } |
555 | 589 | }
|
0 commit comments