(refs #198)Allow group editing by group members.

This commit is contained in:
takezoe
2014-03-03 01:45:00 +09:00
parent d870896cfb
commit 17920e1195
7 changed files with 43 additions and 15 deletions

View File

@@ -13,14 +13,14 @@ import org.apache.commons.io.FileUtils
class CreateController extends CreateControllerBase
with RepositoryService with AccountService with WikiService with LabelsService with ActivityService
with UsersAuthenticator with ReadableUsersAuthenticator
with UsersAuthenticator with ReadableUsersAuthenticator with GroupMemberAuthenticator
/**
* Creates new repository or group.
*/
trait CreateControllerBase extends AccountManagementControllerBase {
self: RepositoryService with AccountService with WikiService with LabelsService with ActivityService
with UsersAuthenticator with ReadableUsersAuthenticator =>
with UsersAuthenticator with ReadableUsersAuthenticator with GroupMemberAuthenticator =>
case class RepositoryCreationForm(owner: String, name: String, description: Option[String],
isPrivate: Boolean, createReadme: Boolean)
@@ -207,13 +207,13 @@ trait CreateControllerBase extends AccountManagementControllerBase {
redirect(s"/${form.groupName}")
})
get("/:groupName/_edit")(usersOnly { // TODO group manager only
get("/:groupName/_edit")(membersOnly {
defining(params("groupName")){ groupName =>
html.group(getAccountByUserName(groupName, true), getGroupMembers(groupName))
}
})
post("/:groupName/_edit", editGroupForm)(usersOnly { form => // TODO group manager only
post("/:groupName/_edit", editGroupForm)(membersOnly { form =>
defining(params("groupName"), form.memberNames.map(_.split(",").toList).getOrElse(Nil)){ case (groupName, memberNames) =>
getAccountByUserName(groupName, true).map { account =>
updateGroup(groupName, form.url, form.isRemoved)