mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 22:45:51 +01:00
(refs #71)Fix authentication for forking repository.
This commit is contained in:
@@ -1,24 +1,25 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import util.Directory._
|
import util.Directory._
|
||||||
import util.{LockUtil, JGitUtil, UsersAuthenticator, ReferrerAuthenticator}
|
import util._
|
||||||
import service._
|
import service._
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import org.eclipse.jgit.api.Git
|
import org.eclipse.jgit.api.Git
|
||||||
import org.apache.commons.io._
|
import org.apache.commons.io._
|
||||||
import jp.sf.amateras.scalatra.forms._
|
import jp.sf.amateras.scalatra.forms._
|
||||||
import org.eclipse.jgit.lib.PersonIdent
|
import org.eclipse.jgit.lib.PersonIdent
|
||||||
|
import scala.Some
|
||||||
|
|
||||||
class CreateRepositoryController extends CreateRepositoryControllerBase
|
class CreateRepositoryController extends CreateRepositoryControllerBase
|
||||||
with RepositoryService with AccountService with WikiService with LabelsService with ActivityService
|
with RepositoryService with AccountService with WikiService with LabelsService with ActivityService
|
||||||
with UsersAuthenticator with ReferrerAuthenticator
|
with UsersAuthenticator with ReadableUsersAuthenticator
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new repository.
|
* Creates new repository.
|
||||||
*/
|
*/
|
||||||
trait CreateRepositoryControllerBase extends ControllerBase {
|
trait CreateRepositoryControllerBase extends ControllerBase {
|
||||||
self: RepositoryService with AccountService with WikiService with LabelsService with ActivityService
|
self: RepositoryService with AccountService with WikiService with LabelsService with ActivityService
|
||||||
with UsersAuthenticator with ReferrerAuthenticator =>
|
with UsersAuthenticator with ReadableUsersAuthenticator =>
|
||||||
|
|
||||||
case class RepositoryCreationForm(owner: String, name: String, description: Option[String], isPrivate: Boolean, createReadme: Boolean)
|
case class RepositoryCreationForm(owner: String, name: String, description: Option[String], isPrivate: Boolean, createReadme: Boolean)
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@ trait CreateRepositoryControllerBase extends ControllerBase {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
post("/:owner/:repository/_fork")(referrersOnly { repository =>
|
get("/:owner/:repository/fork")(readableUsersOnly { repository =>
|
||||||
val loginAccount = context.loginAccount.get
|
val loginAccount = context.loginAccount.get
|
||||||
val loginUserName = loginAccount.userName
|
val loginUserName = loginAccount.userName
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
@import view.helpers._
|
@import view.helpers._
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
<div class="input-prepend">
|
<div class="input-prepend">
|
||||||
<input type="button" id="fork" class="btn" value="Fork" style="margin-bottom: 10px;"/>
|
<a href="@path/@repository.owner/@repository.name/fork" class="btn" style="margin-bottom: 10px;">Fork</a>
|
||||||
<span class="add-on"><a href="@url(repository)/network/members">@repository.forkedCount</a></span>
|
<span class="add-on"><a href="@url(repository)/network/members">@repository.forkedCount</a></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -49,12 +49,5 @@ $(function(){
|
|||||||
location.href = $(this).find('a').attr('href');
|
location.href = $(this).find('a').attr('href');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO Execute by Ajax?
|
|
||||||
$('#fork').click(function(){
|
|
||||||
var form = $('form#repository_form');
|
|
||||||
form.attr('action', '@path/@repository.owner/@repository.name/_fork');
|
|
||||||
form.submit();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user