package org.jivesoftware.openfire.plugin.rest.service;

import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;

import org.jivesoftware.openfire.plugin.rest.exceptions.ServiceException;
import org.jivesoftware.openfire.plugin.rest.controller.MUCRoomController;

@Path("restapi/v1/chatrooms/{roomName}/admins")
public class MUCRoomAdminsService {

	@POST
	@Path("/{jid}")
	public Response addMUCRoomAdmin(@DefaultValue("conference") @QueryParam("servicename") String serviceName,
			@PathParam("jid") String jid, @PathParam("roomName") String roomName) throws ServiceException {
		MUCRoomController.getInstance().addAdmin(serviceName, roomName, jid);
		return Response.status(Status.CREATED).build();
	}

	@POST
	@Path("/group/{groupname}")
	public Response addMUCRoomAdminGroup(@DefaultValue("conference") @QueryParam("servicename") String serviceName,
			@PathParam("groupname") String groupname, @PathParam("roomName") String roomName) throws ServiceException {
		MUCRoomController.getInstance().addAdmin(serviceName, roomName, groupname);
		return Response.status(Status.CREATED).build();
	}

	@DELETE
	@Path("/{jid}")
	public Response deleteMUCRoomAdmin(@PathParam("jid") String jid,
			@DefaultValue("conference") @QueryParam("servicename") String serviceName,
			@PathParam("roomName") String roomName) throws ServiceException {
		MUCRoomController.getInstance().deleteAffiliation(serviceName, roomName, jid);
		return Response.status(Status.OK).build();
	}
}

@@ -1647,11 +1647,415 @@
 ld();%0A%09%7D
+%0A%0A%09@DELETE%0A%09@Path(%22/group/%7Bgroupname%7D%22)%0A%09public Response deleteMUCRoomAdminGroup(@PathParam(%22groupname%22) String groupname,%0A%09%09%09@DefaultValue(%22conference%22) @QueryParam(%22servicename%22) String serviceName,%0A%09%09%09@PathParam(%22roomName%22) String roomName) throws ServiceException %7B%0A%09%09MUCRoomController.getInstance().deleteAffiliation(serviceName, roomName, groupname);%0A%09%09return Response.status(Status.OK).build();%0A%09%7D
 %0A%7D%0A

add missing change for deleting admin groups