summaryrefslogtreecommitdiffstats
path: root/models/user.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-11-03 18:40:52 -0500
committerUnknwon <u@gogs.io>2015-11-03 18:40:52 -0500
commit6f0a41b8b28ba33382ab8d655c0d015324be7647 (patch)
treed30191b529354c42aaf8ae4066d73b402c0b4bb2 /models/user.go
parent25ec20d5251511ebd0b9e6b963e189b860c39704 (diff)
downloadgitea-6f0a41b8b28ba33382ab8d655c0d015324be7647.tar.gz
gitea-6f0a41b8b28ba33382ab8d655c0d015324be7647.zip
#1511 Allow local import only for admin users
Diffstat (limited to 'models/user.go')
-rw-r--r--models/user.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/models/user.go b/models/user.go
index 4109f4d95c..516c424988 100644
--- a/models/user.go
+++ b/models/user.go
@@ -75,9 +75,10 @@ type User struct {
LastRepoVisibility bool
// Permissions.
- IsActive bool
- IsAdmin bool
- AllowGitHook bool
+ IsActive bool
+ IsAdmin bool
+ AllowGitHook bool
+ AllowImportLocal bool // Allow migrate repository by local path
// Avatar.
Avatar string `xorm:"VARCHAR(2048) NOT NULL"`
@@ -107,6 +108,16 @@ func (u *User) AfterSet(colName string, _ xorm.Cell) {
}
}
+// CanEditGitHook returns true if user can edit Git hooks.
+func (u *User) CanEditGitHook() bool {
+ return u.IsAdmin || u.AllowGitHook
+}
+
+// CanImportLocal returns true if user can migrate repository by local path.
+func (u *User) CanImportLocal() bool {
+ return u.IsAdmin || u.AllowImportLocal
+}
+
// EmailAdresses is the list of all email addresses of a user. Can contain the
// primary email address, but is not obligatory
type EmailAddress struct {