diff options
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/models/user.go b/models/user.go index 4109f4d9..516c4249 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 { |