Skip to content

Commit

Permalink
Merge pull request #78 from RADAR-base/release-0.11.0
Browse files Browse the repository at this point in the history
Release 0.11.0
  • Loading branch information
blootsvoets authored Oct 17, 2023
2 parents d639844 + 36fd3d8 commit 4ef6ddb
Show file tree
Hide file tree
Showing 117 changed files with 2,086 additions and 2,360 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
# Change these settings to your own preference
indent_style = space
indent_size = 4

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.{json,yaml,yml}]
indent_size = 2
9 changes: 5 additions & 4 deletions .github/workflows/publish_snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Has SNAPSHOT version
id: is-snapshot
run: grep 'version = ".*-SNAPSHOT"' build.gradle.kts

- uses: actions/setup-java@v3
with:
distribution: temurin
Expand All @@ -29,6 +25,11 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Has SNAPSHOT version
id: is-snapshot
run: |
./gradlew properties | grep 'version: .*-SNAPSHOT'
- name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:

# Compile code
- name: Compile code
run: ./gradlew assemble
run: ./gradlew assemble collectLicenses

# Upload it to GitHub
- name: Upload to GitHub
uses: AButler/[email protected]
uses: AButler/[email protected].2
with:
files: 'radar-jersey/build/libs/*;radar-jersey-hibernate/build/libs/*'
files: 'radar-jersey/build/libs/*;radar-jersey-hibernate/build/libs/*;radar-jersey*/build/reports/*.tar.gz'
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install gpg secret key
Expand Down
53 changes: 44 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {
}
dependencies {
api("org.radarbase:radar-jersey:0.10.0")
api("org.radarbase:radar-jersey:0.11.0")
}
```

Expand All @@ -21,27 +21,62 @@ Any path or resource that should be authenticated against the ManagementPortal,
@Path("/projects")
@Authenticated
class Users(
@Context projectService: MyProjectService
@Context private val projectService: MyProjectService,
@Context private val asyncService: AsyncCoroutineService,
@Context private val authService: AuthService,
) {
// Most services can be run as coroutines with
// asynchronous handling
@GET
@NeedsPermission(Permission.PROJECT_READ)
fun getProjects(@Context auth: Auth): List<Project> {
return projectService.read()
.filter { auth.token.hasPermissionOnProject(PROJECT_READ, it.name) }
fun getProjects(
@Suspended asyncResponse: AsyncResponse,
) = asyncService.runAsCoroutine(asyncResponse) {
projectService.read()
.filter { authService.hasPermission(PROJECT_READ, entityDetails { project(it.name) }) }
}

@POST
@Path("/{projectId}")
@NeedsPermission(Permission.PROJECT_UPDATE, "projectId")
fun updateProject(@PathParam("projectId") projectId: String, project: Project) {
return projectService.update(projectId, project)
fun updateProject(
@PathParam("projectId") projectId: String,
project: Project,
@Suspended asyncResponse: AsyncResponse,
) = asyncService.runAsCoroutine(asyncResponse) {
projectService.update(projectId, project)
}

@GET
@Path("/{projectId}/users/{userId}")
@NeedsPermission(Permission.SUBJECT_READ, "projectId", "userId")
fun getUsers(@PathParam("projectId") projectId: String, @PathParam("userId") userId: String) {
return projectService.readUser(projectId, userId)
fun getUsers(
@PathParam("projectId") projectId: String,
@PathParam("userId") userId: String,
@Suspended asyncResponse: AsyncResponse,
) = asyncService.runAsCoroutine(asyncResponse) {
projectService.readUser(projectId, userId)
}

// Simple responses can be handled without context switches
@GET
@Path("/{projectId}/settings")
@NeedsPermission(Permission.PROJECT_READ, "projectId")
fun getProjectSettings(
@PathParam("projectId") projectId: String,
): ProjectSettingsDto {
return ProjectSettingsDto(projectId = projectId)
}

// Simple coroutine responses can also handled without context switches
@GET
@Path("/{projectId}/users/{userId}/settings")
@NeedsPermission(Permission.SUBJECT_READ, "projectId", "userId")
fun getProjectSettings(
@PathParam("projectId") projectId: String,
@PathParam("userId") userId: String,
) = asyncService.runBlocking {
UserSettingsDto(projectId = projectId, userId = userId)
}
}
```
Expand Down
Loading

0 comments on commit 4ef6ddb

Please sign in to comment.