From 991b19a1b8cb1882cb4c1e7fead6eddf018f2729 Mon Sep 17 00:00:00 2001 From: norangebit Date: Sat, 9 Nov 2019 23:57:15 +0100 Subject: [PATCH] add SetBoardMemberPermission --- .../java/wekan/wrapper/api/BoardService.java | 8 +++++ .../wrapper/entity/MemberPermission.java | 34 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 wrapper/src/main/java/wekan/wrapper/entity/MemberPermission.java diff --git a/wrapper/src/main/java/wekan/wrapper/api/BoardService.java b/wrapper/src/main/java/wekan/wrapper/api/BoardService.java index 5670561..3842d2f 100644 --- a/wrapper/src/main/java/wekan/wrapper/api/BoardService.java +++ b/wrapper/src/main/java/wekan/wrapper/api/BoardService.java @@ -3,6 +3,7 @@ package wekan.wrapper.api; import retrofit2.Call; import retrofit2.http.*; import wekan.wrapper.entity.Board; +import wekan.wrapper.entity.MemberPermission; import wekan.wrapper.entity.BoardPrototype; import java.util.List; @@ -20,6 +21,13 @@ public interface BoardService { @DELETE("api/boards/{boardId}") Call deleteBoard(@Path("boardId") String boardId); + @POST("/api/boards/{boardId}/members/{memberId}") + Call setBoardMemberPermission( + @Path("boardId") String board, + @Path("memberId") String member, + @Body MemberPermission memberPermission + ); + @GET("api/users/{userId}/boards") Call> getBoardsFromUser(@Path("userId") String userId); } diff --git a/wrapper/src/main/java/wekan/wrapper/entity/MemberPermission.java b/wrapper/src/main/java/wekan/wrapper/entity/MemberPermission.java new file mode 100644 index 0000000..d321ec1 --- /dev/null +++ b/wrapper/src/main/java/wekan/wrapper/entity/MemberPermission.java @@ -0,0 +1,34 @@ +package wekan.wrapper.entity; + +public class MemberPermission { + public final static MemberPermission ADMIN = new MemberPermission( + true, + false, + false + ); + public final static MemberPermission NORMAL = new MemberPermission( + false, + false, + false + ); + public final static MemberPermission NO_COMMENTS = new MemberPermission( + false, + true, + false + ); + public final static MemberPermission COMMENT_ONLY = new MemberPermission( + false, + false, + true + ); + + private boolean isAdmin; + private boolean isNoComments; + private boolean isCommentOnly; + + private MemberPermission(boolean isAdmin, boolean isNoComments, boolean isCommentOnly) { + this.isAdmin = isAdmin; + this.isNoComments = isNoComments; + this.isCommentOnly = isCommentOnly; + } +}