-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7d274c
commit 486f875
Showing
8 changed files
with
68 additions
and
15 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
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
11 changes: 11 additions & 0 deletions
11
server/src/main/java/io/flexwork/modules/usermanagement/service/dto/ResourceDTO.java
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package io.flexwork.modules.usermanagement.service.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class ResourceDTO { | ||
private String name; | ||
private String description; | ||
} |
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
35 changes: 35 additions & 0 deletions
35
server/src/main/java/io/flexwork/modules/usermanagement/web/rest/ResourceController.java
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package io.flexwork.modules.usermanagement.web.rest; | ||
|
||
import io.flexwork.modules.usermanagement.repository.ResourceRepository; | ||
import io.flexwork.modules.usermanagement.service.dto.ResourceDTO; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/api/resources") | ||
public class ResourceController { | ||
|
||
private final ResourceRepository resourceRepository; | ||
|
||
@Autowired | ||
public ResourceController(ResourceRepository resourceRepository) { | ||
this.resourceRepository = resourceRepository; | ||
} | ||
|
||
@GetMapping | ||
public ResponseEntity<List<ResourceDTO>> getAllResources() { | ||
List<ResourceDTO> resources = | ||
resourceRepository.findAll().stream() | ||
.map( | ||
resource -> | ||
new ResourceDTO( | ||
resource.getName(), resource.getDescription())) | ||
.collect(Collectors.toList()); | ||
return ResponseEntity.ok(resources); | ||
} | ||
} |
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
6 changes: 3 additions & 3 deletions
6
...quibase/src/main/resources/config/liquibase/tenant/data/authority_resource_permission.csv
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
authority_name;resource_name;permission | ||
ROLE_USER;user;READ | ||
ROLE_USER;account;READ | ||
ROLE_USER;contact;READ | ||
ROLE_USER;User;READ | ||
ROLE_USER;Account;WRITE | ||
ROLE_USER;Contact;WRITE |
14 changes: 8 additions & 6 deletions
14
tools/liquibase/src/main/resources/config/liquibase/tenant/data/resource.csv
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
name | ||
user | ||
file | ||
account | ||
contact | ||
case | ||
name;description | ||
User; | ||
File; | ||
Account; | ||
Contact; | ||
Case; | ||
Team; | ||
Organization; |