// Copyright 2014 The Gogs Authors. All rights reserved.// Use of this source code is governed by a MIT-style// license that can be found in the LICENSE file.packagemodelsimport("strings""time")const(AU_READABLE=iota+1AU_WRITABLE)typeAccessstruct{Idint64UserNamestring`xorm:"unique(s)"`RepoNamestring`xorm:"unique(s)"`Modeint`xorm:"unique(s)"`Createdtime.Time`xorm:"created"`}funcAddAccess(access*Access)error{_,err:=orm.Insert(access)returnerr}// if one user can read or write one repositoryfuncHasAccess(userName,repoNamestring,modeint)(bool,error){returnorm.Get(&Access{Id:0,UserName:strings.ToLower(userName),RepoName:strings.ToLower(repoName),Mode:mode,})}