package de.cinovo.cloudconductor.api.interfaces;

import java.util.List;

import javax.annotation.security.RolesAllowed;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import de.cinovo.cloudconductor.api.MediaType;
import de.cinovo.cloudconductor.api.model.UserGroup;

/**
 * Copyright 2017 Cinovo AG<br>
 * <br>
 *
 * @author psigloch
 */
@Path("/usergroup")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface IUserGroup {
	
	/**
	 * @return list of usergroups
	 */
	@GET
	@RolesAllowed({"VIEW_USERS", "EDIT_USERS"})
	List<UserGroup> getUserGroups();
	
	/**
	 * @param userGroup the user group to save
	 */
	@PUT
	@RolesAllowed({"EDIT_USERS"})
	void save(UserGroup userGroup);
	
	/**
	 * 
	 * @param userGroupName the name of the user group
	 * @return the requested user group
	 */
	@GET
	@Path("/{usergroupname}")
	@RolesAllowed({"VIEW_USERS", "EDIT_USERS"})
	UserGroup getUserGroup(@PathParam("usergroupname") String userGroupName);
	
	/**
	 * @param userGroupName the user group name
	 */
	@DELETE
	@Path("/{usergroupname}")
	@RolesAllowed({"EDIT_USERS"})
	void delete(@PathParam("usergroupname") String userGroupName);
	
}

@@ -364,16 +364,65 @@
 aType;%0D%0A
+import de.cinovo.cloudconductor.api.model.User;%0D%0A
 import d
@@ -1412,11 +1412,262 @@
 e);%0D%0A%09%0D%0A
+%09/**%0D%0A%09 * %0D%0A%09 * @param userGroupName%0D%0A%09 * @return list of group members%0D%0A%09 */%0D%0A%09@GET%0D%0A%09@Path(%22/%7Busergroupname%7D/members%22)%0D%0A%09@RolesAllowed(%7B%22VIEW_USERS%22, %22EDIT_USERS%22%7D)%0D%0A%09List%3CUser%3E getGroupMembers(@PathParam(%22usergroupname%22) String userGroupName);%0D%0A%09%0D%0A
 %7D%0D%0A

Add interface to get members of a group.