Commit a1927b61 authored by igoshin's avatar igoshin Committed by Matija Obreza
Browse files

Edit team information and memberships

parent a51848f6
......@@ -100,4 +100,6 @@ public interface TeamService {
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#team, 'READ')")
List<User> getMembers(Team team);
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#team, 'WRITE')")
void updateTeamInformation(String teamUuid, String teamName);
}
......@@ -176,4 +176,12 @@ public class TeamServiceImpl implements TeamService {
public List<User> getMembers(Team team) {
return teamRepository.listMembers(team);
}
@Override
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#team, 'WRITE')")
public void updateTeamInformation(String teamUuid, String teamName) {
Team team = teamRepository.findOneByUuid(teamUuid);
team.setName(teamName);
teamRepository.saveAndFlush(team);
}
}
......@@ -106,4 +106,23 @@ public class TeamController extends BaseController {
return "redirect:/team/" + teamUuid;
}
@RequestMapping("/{teamUuid}/edit")
public String editTeamInformation(@PathVariable("teamUuid")String teamUuid,ModelMap model){
Team team = teamService.getTeam(teamUuid);
if (team == null) {
throw new ResourceNotFoundException();
}
model.addAttribute("team", team);
return "/team/edit";
}
@RequestMapping("/{teamUuid}/update")
public String updateTeamInformation(@PathVariable("teamUuid")String teamUuid,
@RequestParam("teamName")String teamName){
teamService.updateTeamInformation(teamUuid,teamName);
return "redirect:/team/" + teamUuid;
}
}
......@@ -451,3 +451,4 @@ oauth-client.issued.tokens=Issued tokens
team.user.enter.email=Enter user email
user.not.found=User not found
team.profile.update.title=Update team information
......@@ -10,7 +10,7 @@
<h1>
<c:out value="${team.name}" />
</h1>
<a href="<c:url value="/team/${team.uuid}/edit" />" class="close"><spring:message code="edit" /></a>
<security:authorize access="hasRole('ADMINISTRATOR') or hasPermission(#team, 'WRITE')">
<a href="<c:url value="/acl/${team['class'].name}/${team.id}/permissions"><c:param name="back">/team/${team.uuid}</c:param></c:url>" class="btn btn-default"> <spring:message code="edit-acl" /></a>
</security:authorize>
......@@ -19,6 +19,8 @@
<spring:message code="team.team-members" arguments="${teammembers.size()}" />
</h4>
<ul class="funny-list">
<c:forEach items="${teammembers}" var="user" varStatus="status">
<li class="${status.count % 2 == 0 ? 'even' : 'odd'}">
......@@ -32,7 +34,7 @@
<security:authorize access="hasRole('ADMINISTRATOR') or hasPermission(#team, 'WRITE')">
<form action="<c:url value="/team/${team.uuid}/addMember"/>" class="form-horizontal">
<div class="form-group">
<label for="email" class="col-lg-1 control-label"><spring:message code="team.user.enter.email"/></label>
<label for="email" class="col-lg-2 control-label"><spring:message code="team.user.enter.email"/></label>
<div class="col-lg-3"><input type="text" id="email" name="email" class="form-control"/></div>
<div class="col-lg-3"><input type="submit" class="btn btn-green" value="<spring:message code="add"/>"/>
</div>
......
<!DOCTYPE html>
<%@include file="/WEB-INF/jsp/init.jsp"%>
<html>
<head>
<title><spring:message code="team.profile.update.title" /></title>
</head>
<body>
<h1>
<spring:message code="team.profile.update.title" />
</h1>
<form role="form" class="form-horizontal validate" action="<c:url value="/team/${team.uuid}/update" />" method="post">
<div class="form-group">
<label for="name" class="col-lg-2 control-label"><spring:message code="team.team-name" /></label>
<div class="col-lg-3">
<input type="text" id="name" name="teamName" class="span3 form-control" value="${team.name}" />
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<input type="submit" value="<spring:message code="save"/>" class="btn btn-primary" />
<a class="btn btn-default" href="<c:url value="/team/${team.uuid}" />" class="btn"> <spring:message code="cancel" />
</a>
</div>
</div>
</form>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment