diff options
author | Unknown <joe2010xtmf@163.com> | 2014-06-25 00:44:48 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-06-25 00:44:48 -0400 |
commit | e0f9c628c5ff7399167944b3d0730698487af498 (patch) | |
tree | cb296196a29b713d4aa224a296e5088021e6b777 /models/access.go | |
parent | b2801a2e985f11e940a0cd420cea57242ea26d4c (diff) | |
download | gitea-e0f9c628c5ff7399167944b3d0730698487af498.tar.gz gitea-e0f9c628c5ff7399167944b3d0730698487af498.zip |
Add create organization
Diffstat (limited to 'models/access.go')
-rw-r--r-- | models/access.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/models/access.go b/models/access.go index cf31fc137b..5238daba32 100644 --- a/models/access.go +++ b/models/access.go @@ -11,19 +11,20 @@ import ( "github.com/go-xorm/xorm" ) -// Access types. +type AccessType int + const ( - AU_READABLE = iota + 1 - AU_WRITABLE + READABLE AccessType = iota + 1 + WRITABLE ) // Access represents the accessibility of user to repository. type Access struct { Id int64 - UserName string `xorm:"unique(s)"` - RepoName string `xorm:"unique(s)"` // <user name>/<repo name> - Mode int `xorm:"unique(s)"` - Created time.Time `xorm:"created"` + UserName string `xorm:"unique(s)"` + RepoName string `xorm:"unique(s)"` // <user name>/<repo name> + Mode AccessType `xorm:"unique(s)"` + Created time.Time `xorm:"created"` } // AddAccess adds new access record. @@ -59,7 +60,7 @@ func UpdateAccessWithSession(sess *xorm.Session, access *Access) error { // HasAccess returns true if someone can read or write to given repository. // The repoName should be in format <username>/<reponame>. -func HasAccess(uname, repoName string, mode int) (bool, error) { +func HasAccess(uname, repoName string, mode AccessType) (bool, error) { if len(repoName) == 0 { return false, nil } |