From 0124f7cc3c8ec7669f80d6aae290eb4d5b5c25d1 Mon Sep 17 00:00:00 2001 From: Naoki Takezoe Date: Sun, 28 Sep 2014 11:35:19 +0900 Subject: [PATCH] (refs #488)Change permission to access to labels --- src/main/scala/app/LabelsController.scala | 15 ++++++++++----- src/main/twirl/issues/labels/list.scala.html | 17 ++++++++++------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main/scala/app/LabelsController.scala b/src/main/scala/app/LabelsController.scala index 3fe8c0427..af01bdcc1 100644 --- a/src/main/scala/app/LabelsController.scala +++ b/src/main/scala/app/LabelsController.scala @@ -2,15 +2,17 @@ package app import jp.sf.amateras.scalatra.forms._ import service._ -import util.CollaboratorsAuthenticator +import util.{ReferrerAuthenticator, CollaboratorsAuthenticator} import util.Implicits._ import org.scalatra.i18n.Messages class LabelsController extends LabelsControllerBase - with LabelsService with RepositoryService with AccountService with CollaboratorsAuthenticator + with LabelsService with RepositoryService with AccountService +with ReferrerAuthenticator with CollaboratorsAuthenticator trait LabelsControllerBase extends ControllerBase { - self: LabelsService with RepositoryService with CollaboratorsAuthenticator => + self: LabelsService with RepositoryService + with ReferrerAuthenticator with CollaboratorsAuthenticator => case class LabelForm(labelName: String, color: String) @@ -24,8 +26,11 @@ trait LabelsControllerBase extends ControllerBase { "editColor" -> trim(label("Color", text(required, color))) )(LabelForm.apply) - get("/:owner/:repository/issues/labels")(collaboratorsOnly { repository => - issues.labels.html.list(getLabels(repository.owner, repository.name), repository, true) // TODO hasWritePermission + get("/:owner/:repository/issues/labels")(referrersOnly { repository => + issues.labels.html.list( + getLabels(repository.owner, repository.name), + repository, + hasWritePermission(repository.owner, repository.name, context.loginAccount)) }) ajaxGet("/:owner/:repository/issues/labels/new")(collaboratorsOnly { repository => diff --git a/src/main/twirl/issues/labels/list.scala.html b/src/main/twirl/issues/labels/list.scala.html index a83464c39..f5b5b87ec 100644 --- a/src/main/twirl/issues/labels/list.scala.html +++ b/src/main/twirl/issues/labels/list.scala.html @@ -22,21 +22,24 @@
- @label.labelName + @label.labelName
-
- x open issues +
+
+ x open issues +
-
- @if(hasWritePermission){ + @if(hasWritePermission){ +
Edit +    Delete
- } -
+
+ }