diff --git a/src/main/scala/app/LabelsController.scala b/src/main/scala/app/LabelsController.scala index 3fe8c04..af01bdc 100644 --- a/src/main/scala/app/LabelsController.scala +++ b/src/main/scala/app/LabelsController.scala @@ -2,15 +2,17 @@ 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 @@ "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 a83464c..f5b5b87 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
- } -
+
+ }