-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EPMRPP-89198 routing refactor (#984)
* EPMRPP-89198 organizations routing refactoring * EPMRPP-89198 model dependency update
- Loading branch information
Showing
47 changed files
with
1,849 additions
and
409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ on: | |
branches: | ||
- master | ||
- develop | ||
- feature/orgs | ||
paths-ignore: | ||
- '.github/**' | ||
- README.md | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,4 @@ jooq { | |
|
||
generateSampleJooqSchemaSource { | ||
enabled = false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
|
||
import static java.util.Optional.ofNullable; | ||
|
||
import com.epam.ta.reportportal.entity.organization.OrganizationRole; | ||
import com.epam.ta.reportportal.entity.project.ProjectRole; | ||
import com.epam.ta.reportportal.entity.user.UserRole; | ||
import com.epam.ta.reportportal.exception.ReportPortalException; | ||
|
@@ -28,6 +29,10 @@ | |
import java.util.Collections; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.security.core.GrantedAuthority; | ||
import org.springframework.security.core.authority.SimpleGrantedAuthority; | ||
import org.springframework.security.core.userdetails.User; | ||
|
@@ -38,6 +43,9 @@ | |
* | ||
* @author <a href="mailto:[email protected]">Andrei Varabyeu</a> | ||
*/ | ||
@Getter | ||
@Setter | ||
@EqualsAndHashCode(callSuper = false) | ||
public class ReportPortalUser extends User { | ||
|
||
private Long userId; | ||
|
@@ -47,6 +55,8 @@ public class ReportPortalUser extends User { | |
private String email; | ||
|
||
private Map<String, ProjectDetails> projectDetails; | ||
private Map<String, OrganizationDetails> organizationDetails; | ||
|
||
|
||
private ReportPortalUser(String username, String password, | ||
Collection<? extends GrantedAuthority> authorities, Long userId, | ||
|
@@ -62,38 +72,8 @@ public static ReportPortalUserBuilder userBuilder() { | |
return new ReportPortalUserBuilder(); | ||
} | ||
|
||
public Long getUserId() { | ||
return userId; | ||
} | ||
|
||
public void setUserId(Long userId) { | ||
this.userId = userId; | ||
} | ||
|
||
public UserRole getUserRole() { | ||
return userRole; | ||
} | ||
|
||
public void setUserRole(UserRole userRole) { | ||
this.userRole = userRole; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public void setEmail(String email) { | ||
this.email = email; | ||
} | ||
|
||
public Map<String, ProjectDetails> getProjectDetails() { | ||
return projectDetails; | ||
} | ||
|
||
public void setProjectDetails(Map<String, ProjectDetails> projectDetails) { | ||
this.projectDetails = projectDetails; | ||
} | ||
|
||
@Getter | ||
@Setter | ||
public static class ProjectDetails implements Serializable { | ||
|
||
@JsonProperty(value = "id") | ||
|
@@ -102,35 +82,29 @@ public static class ProjectDetails implements Serializable { | |
@JsonProperty(value = "name") | ||
private String projectName; | ||
|
||
@JsonProperty(value = "key") | ||
private String projectKey; | ||
|
||
@JsonProperty("role") | ||
private ProjectRole projectRole; | ||
|
||
public ProjectDetails(Long projectId, String projectName, ProjectRole projectRole) { | ||
public ProjectDetails(Long projectId, String projectName, ProjectRole projectRole, | ||
String projectKey) { | ||
this.projectId = projectId; | ||
this.projectName = projectName; | ||
this.projectRole = projectRole; | ||
this.projectKey = projectKey; | ||
} | ||
|
||
public static ProjectDetailsBuilder builder() { | ||
return new ProjectDetailsBuilder(); | ||
} | ||
|
||
public Long getProjectId() { | ||
return projectId; | ||
} | ||
|
||
public String getProjectName() { | ||
return projectName; | ||
} | ||
|
||
public ProjectRole getProjectRole() { | ||
return projectRole; | ||
} | ||
|
||
public static class ProjectDetailsBuilder { | ||
|
||
private Long projectId; | ||
private String projectName; | ||
private String projectKey; | ||
private ProjectRole projectRole; | ||
|
||
private ProjectDetailsBuilder() { | ||
|
@@ -146,14 +120,68 @@ public ProjectDetailsBuilder withProjectName(String projectName) { | |
return this; | ||
} | ||
|
||
public ProjectDetailsBuilder withProjectKey(String projectKey) { | ||
this.projectKey = projectKey; | ||
return this; | ||
} | ||
|
||
public ProjectDetailsBuilder withProjectRole(String projectRole) { | ||
this.projectRole = ProjectRole.forName(projectRole) | ||
.orElseThrow(() -> new ReportPortalException(ErrorType.ROLE_NOT_FOUND, projectRole)); | ||
return this; | ||
} | ||
|
||
public ProjectDetails build() { | ||
return new ProjectDetails(projectId, projectName, projectRole); | ||
return new ProjectDetails(projectId, projectName, projectRole, projectKey); | ||
} | ||
} | ||
} | ||
|
||
@Getter | ||
@Setter | ||
@AllArgsConstructor | ||
public static class OrganizationDetails implements Serializable { | ||
|
||
@JsonProperty(value = "id") | ||
private Long orgId; | ||
|
||
@JsonProperty(value = "name") | ||
private String orgName; | ||
|
||
@JsonProperty("role") | ||
private OrganizationRole orgRole; | ||
|
||
public static OrganizationDetailsBuilder builder() { | ||
return new OrganizationDetailsBuilder(); | ||
} | ||
|
||
public static class OrganizationDetailsBuilder { | ||
|
||
private Long orgId; | ||
private String orgName; | ||
private OrganizationRole orgRole; | ||
|
||
private OrganizationDetailsBuilder() { | ||
} | ||
|
||
public OrganizationDetailsBuilder withOrgId(Long orgId) { | ||
this.orgId = orgId; | ||
return this; | ||
} | ||
|
||
public OrganizationDetailsBuilder withOrgName(String orgName) { | ||
this.orgName = orgName; | ||
return this; | ||
} | ||
|
||
public OrganizationDetailsBuilder withProjectRole(String orgRole) { | ||
this.orgRole = OrganizationRole.forName(orgRole) | ||
.orElseThrow(() -> new ReportPortalException(ErrorType.ROLE_NOT_FOUND, orgRole)); | ||
return this; | ||
} | ||
|
||
public OrganizationDetails build() { | ||
return new OrganizationDetails(orgId, orgName, orgRole); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.