summaryrefslogtreecommitdiffstats
path: root/models/access.go
diff options
context:
space:
mode:
authorPeter Smit <peter@smitmail.eu>2015-02-09 13:36:33 +0200
committerPeter Smit <peter@smitmail.eu>2015-02-09 13:36:33 +0200
commit0d158e569b0c19614b5e946849e8b7a8e4a75015 (patch)
tree7702d6fbf2d26b789520f7ef9db11946797e1942 /models/access.go
parent4e79adf6b5bf7ec7bc3b2b47469baafd1cb0b774 (diff)
downloadgitea-0d158e569b0c19614b5e946849e8b7a8e4a75015.tar.gz
gitea-0d158e569b0c19614b5e946849e8b7a8e4a75015.zip
Change constants to UPPERCASE_WITH_UNDERSCORE style
Diffstat (limited to 'models/access.go')
-rw-r--r--models/access.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/models/access.go b/models/access.go
index ee678a0701..916711f786 100644
--- a/models/access.go
+++ b/models/access.go
@@ -11,15 +11,15 @@ package models
type AccessMode int
const (
- NoAccess AccessMode = iota
- ReadAccess
- WriteAccess
- AdminAccess
- OwnerAccess
+ ACCESS_MODE_NONE AccessMode = iota
+ ACCESS_MODE_READ
+ ACCESS_MODE_WRITE
+ ACCESS_MODE_ADMIN
+ ACCESS_MODE_OWNER
)
func maxAccessMode(modes ...AccessMode) AccessMode {
- max := NoAccess
+ max := ACCESS_MODE_NONE
for _, mode := range modes {
if mode > max {
max = mode
@@ -47,14 +47,14 @@ func HasAccess(u *User, r *Repository, testMode AccessMode) (bool, error) {
// Return the Access a user has to a repository. Will return NoneAccess if the
// user does not have access. User can be nil!
func AccessLevel(u *User, r *Repository) (AccessMode, error) {
- mode := NoAccess
+ mode := ACCESS_MODE_NONE
if !r.IsPrivate {
- mode = ReadAccess
+ mode = ACCESS_MODE_READ
}
if u != nil {
if u.Id == r.OwnerId {
- return OwnerAccess, nil
+ return ACCESS_MODE_OWNER, nil
}
a := &Access{UserID: u.Id, RepoID: r.Id}
@@ -101,7 +101,7 @@ func (r *Repository) RecalcAccessSess() error {
return err
}
for _, c := range collaborators {
- accessMap[c.Id] = WriteAccess
+ accessMap[c.Id] = ACCESS_MODE_WRITE
}
if err := r.GetOwner(); err != nil {
@@ -126,9 +126,9 @@ func (r *Repository) RecalcAccessSess() error {
}
}
- minMode := ReadAccess
+ minMode := ACCESS_MODE_READ
if !r.IsPrivate {
- minMode = WriteAccess
+ minMode = ACCESS_MODE_WRITE
}
newAccesses := make([]Access, 0, len(accessMap))