Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement global permissions endpoint #93

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 186 additions & 0 deletions index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3212,6 +3212,80 @@ ifdef::internal-generation[]
endif::internal-generation[]


[.getPermissionGlobal]
==== getPermissionGlobal

`GET /permissions/global`

Get global permissions configuration

===== Description

Get the global permissions for ... TODO


// markup not found, no include::{specDir}permissions/global/GET/spec.adoc[opts=optional]



===== Parameters







===== Return Type

<<PermissionsGlobalBean>>


===== Content Type

* application/json

===== Responses

.HTTP Response Codes
[cols="2,3,1"]
|===
| Code | Message | Datatype


| 200
|
| <<PermissionsGlobalBean>>


| 400
|
| <<ErrorCollection>>

|===

===== Samples


// markup not found, no include::{snippetDir}permissions/global/GET/http-request.adoc[opts=optional]


// markup not found, no include::{snippetDir}permissions/global/GET/http-response.adoc[opts=optional]



// file not found, no * wiremock data link :permissions/global/GET/GET.json[]


ifdef::internal-generation[]
===== Implementation

// markup not found, no include::{specDir}permissions/global/GET/implementation.adoc[opts=optional]


endif::internal-generation[]


[.setPermissionAnonymousAccess]
==== setPermissionAnonymousAccess

Expand Down Expand Up @@ -3299,6 +3373,93 @@ ifdef::internal-generation[]
endif::internal-generation[]


[.setPermissionGlobal]
==== setPermissionGlobal

`PUT /permissions/global`

Set global permissions configuration

===== Description

Set the global permissions for ... TODO


// markup not found, no include::{specDir}permissions/global/PUT/spec.adoc[opts=optional]



===== Parameters


====== Body Parameter

[cols="2,3,1,1,1"]
|===
|Name| Description| Required| Default| Pattern

| PermissionsGlobalBean
| <<PermissionsGlobalBean>>
| X
|
|

|===





===== Return Type

<<PermissionsGlobalBean>>


===== Content Type

* application/json

===== Responses

.HTTP Response Codes
[cols="2,3,1"]
|===
| Code | Message | Datatype


| 200
|
| <<PermissionsGlobalBean>>


| 400
|
| <<ErrorCollection>>

|===

===== Samples


// markup not found, no include::{snippetDir}permissions/global/PUT/http-request.adoc[opts=optional]


// markup not found, no include::{snippetDir}permissions/global/PUT/http-response.adoc[opts=optional]



// file not found, no * wiremock data link :permissions/global/PUT/PUT.json[]


ifdef::internal-generation[]
===== Implementation

// markup not found, no include::{specDir}permissions/global/PUT/implementation.adoc[opts=optional]


endif::internal-generation[]


[.Ping]
=== Ping

Expand Down Expand Up @@ -5960,6 +6121,31 @@ endif::internal-generation[]
|===


[#PermissionsGlobalBean]
=== _PermissionsGlobalBean_



[.fields-PermissionsGlobalBean]
[cols="2,1,2,4,1"]
|===
| Field Name| Required| Type| Description| Format

| groupPermissions
|
| Map of <<array>>
|
|

| anonymousPermissions
|
| List of <<string>>
|
|

|===


[#SettingsBean]
=== _SettingsBean_

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<atlassian.gadgets.version>8.1.4</atlassian.gadgets.version>
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<atlassian.spring.scanner.version>2.2.4</atlassian.spring.scanner.version>
<confapi-commons.version>0.5.0</confapi-commons.version>
<confapi-commons.version>0.5.1-SNAPSHOT</confapi-commons.version>
<custom-favicon-api.version>2.0.2</custom-favicon-api.version>
<javax.jaxb-api.version>2.3.1</javax.jaxb-api.version>
<javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.aservo.confapi.confluence.rest;

import com.sun.jersey.spi.container.ResourceFilters;
import de.aservo.confapi.commons.model.PermissionsGlobalBean;
import de.aservo.confapi.confluence.filter.SysAdminOnlyResourceFilter;
import de.aservo.confapi.confluence.model.PermissionAnonymousAccessBean;
import de.aservo.confapi.confluence.rest.api.PermissionsResource;
Expand Down Expand Up @@ -28,6 +29,17 @@ public PermissionsResourceImpl(PermissionsService permissionsService) {
this.permissionsService = permissionsService;
}

@Override
public Response getPermissionGlobal() {
return Response.ok(permissionsService.getPermissionsGlobal()).build();
}

@Override
public Response setPermissionGlobal(
@NotNull final PermissionsGlobalBean permissionsGlobalBean) {
return Response.ok(permissionsService.setPermissionsGlobal(permissionsGlobalBean)).build();
}

@Override
public Response getPermissionAnonymousAccess() {
return Response.ok(permissionsService.getPermissionAnonymousAccess()).build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,54 @@
package de.aservo.confapi.confluence.rest.api;

import de.aservo.confapi.confluence.model.PermissionAnonymousAccessBean;
import de.aservo.confapi.commons.constants.ConfAPI;
import de.aservo.confapi.commons.model.ErrorCollection;
import de.aservo.confapi.commons.model.PermissionsGlobalBean;
import de.aservo.confapi.confluence.model.PermissionAnonymousAccessBean;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;

import javax.validation.constraints.NotNull;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

public interface PermissionsResource {

@GET
@Path(ConfAPI.PERMISSIONS_GLOBAL)
@Produces(MediaType.APPLICATION_JSON)
@Operation(
tags = { ConfAPI.PERMISSIONS },
summary = "Get global permissions configuration",
description = "Get the global permissions for ... TODO",
responses = {
@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PermissionsGlobalBean.class))),
@ApiResponse(responseCode = "400", content = @Content(schema = @Schema(implementation = ErrorCollection.class)))
}
)
Response getPermissionGlobal();

@PUT
@Path(ConfAPI.PERMISSIONS_GLOBAL)
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Operation(
tags = { ConfAPI.PERMISSIONS },
summary = "Set global permissions configuration",
description = "Set the global permissions for ... TODO",
responses = {
@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = PermissionsGlobalBean.class))),
@ApiResponse(responseCode = "400", content = @Content(schema = @Schema(implementation = ErrorCollection.class)))
}
)
Response setPermissionGlobal(
@NotNull PermissionsGlobalBean permissionsGlobalBean);

@GET
@Path(ConfAPI.PERMISSION_ANONYMOUS_ACCESS)
@Produces(MediaType.APPLICATION_JSON)
@Operation(
tags = { ConfAPI.PERMISSIONS },
summary = "Retrieve current anonymous access configuration",
Expand All @@ -31,6 +62,8 @@ public interface PermissionsResource {

@PUT
@Path(ConfAPI.PERMISSION_ANONYMOUS_ACCESS)
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Operation(
tags = { ConfAPI.PERMISSIONS },
summary = "Set anonymous access configuration",
Expand Down
Loading
Loading