mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 22:45:51 +01:00
(refs #488)Change permission to access to labels
This commit is contained in:
@@ -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 =>
|
||||
|
||||
@@ -22,21 +22,24 @@
|
||||
<div class="span8">
|
||||
<div style="margin-top: 6px">
|
||||
<a href="@url(repository)/issues?labels=@urlEncode(label.labelName)">
|
||||
<span class="label-color" style="background-color: #@label.color; color: #@label.fontColor; padding: 8px; font-size: 120%;">@label.labelName</span>
|
||||
<span style="background-color: #@label.color; color: #@label.fontColor; padding: 8px; font-size: 120%; border-radius: 4px;">@label.labelName</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="span2">
|
||||
<div class="@if(hasWritePermission){span2} else {span4}">
|
||||
<div class="pull-right">
|
||||
<span class="muted">x open issues</span>
|
||||
</div>
|
||||
<div class="span2">
|
||||
</div>
|
||||
@if(hasWritePermission){
|
||||
<div class="span2">
|
||||
<div class="pull-right">
|
||||
<a href="javascript:void(0);" class="label-edit-link" data-label-id="@label.labelId">Edit</a>
|
||||
|
||||
<a href="@url(repository)/issues/labels/@label.labelId/delete" class="delete">Delete</a>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user