diff --git a/src/main/java/com/ntlab/irisserver/resources/MembersRest.java b/src/main/java/com/ntlab/irisserver/resources/MembersRest.java index 95d7e3c..913baa4 100644 --- a/src/main/java/com/ntlab/irisserver/resources/MembersRest.java +++ b/src/main/java/com/ntlab/irisserver/resources/MembersRest.java @@ -14,8 +14,6 @@ import javax.ws.rs.core.Response; @Component - - @Path("/rooms") public class MembersRest { @@ -52,23 +50,23 @@ //ランダムにチーム編成を送り、全員の役職を変更する @PUT @Path("/{rid}/members") + @Produces(MediaType.APPLICATION_JSON) public void putMembers(@PathParam("rid") String rid, @FormParam("nickname") String nickname) { RoomManager rm = RoomManager.getInstance(); Room room = rm.getRoom(rid); List gm = room.getMembers(); //引数で取ってきたnicknameがownerかどうか確認 - - if(nickname != room.getOwnerName()) { + String owner = room.getOwnerName(); + if(nickname.equals(owner)) { + //全員の役職を変更 + membershuffle(gm); + }else{ var response = Response.status(401).entity("あなたはオーナーではありません"); throw new WebApplicationException(response.build()); } - //全員の役職を変更 - membershuffle(gm); - - } //自分のnicknameを送り、Roomに追加