summaryrefslogtreecommitdiffstats
path: root/models/user
diff options
context:
space:
mode:
Diffstat (limited to 'models/user')
-rw-r--r--models/user/user.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/models/user/user.go b/models/user/user.go
index 71b036b06f..825223201b 100644
--- a/models/user/user.go
+++ b/models/user/user.go
@@ -275,6 +275,15 @@ func (u *User) CanEditGitHook() bool {
return !setting.DisableGitHooks && (u.IsAdmin || u.AllowGitHook)
}
+// CanForkRepo returns if user login can fork a repository
+// It checks especially that the user can create repos, and potentially more
+func (u *User) CanForkRepo() bool {
+ if setting.Repository.AllowForkWithoutMaximumLimit {
+ return true
+ }
+ return u.CanCreateRepo()
+}
+
// CanImportLocal returns true if user can migrate repository by local path.
func (u *User) CanImportLocal() bool {
if !setting.ImportLocalPaths || u == nil {