Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
a1927b61
Commit
a1927b61
authored
Jan 31, 2014
by
igoshin
Committed by
Matija Obreza
Feb 04, 2014
Browse files
Edit team information and memberships
parent
a51848f6
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/service/TeamService.java
View file @
a1927b61
...
...
@@ -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
);
}
src/main/java/org/genesys2/server/service/impl/TeamServiceImpl.java
View file @
a1927b61
...
...
@@ -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
);
}
}
src/main/java/org/genesys2/server/servlet/controller/TeamController.java
View file @
a1927b61
...
...
@@ -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
;
}
}
src/main/resources/content/language.properties
View file @
a1927b61
...
...
@@ -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
src/main/webapp/WEB-INF/jsp/team/details.jsp
View file @
a1927b61
...
...
@@ -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>
...
...
src/main/webapp/WEB-INF/jsp/team/edit.jsp
0 → 100644
View file @
a1927b61
<!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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment