// 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")// Access types.const(AU_READABLE=iota+1AU_WRITABLE)// Access represents the accessibility of user and repository.typeAccessstruct{Idint64UserNamestring`xorm:"unique(s)"`RepoNamestring`xorm:"unique(s)"`Modeint`xorm:"unique(s)"`Createdtime.Time`xorm:"created"`}// AddAccess adds new access record.funcAddAccess(access*Access)error{_,err:=orm.Insert(access)returnerr}// HasAccess returns true if someone can read or write given repository.funcHasAccess(userName,repoNamestring,modeint)(bool,error){returnorm.Get(&Access{Id:0,UserName:strings.ToLower(userName),RepoName:strings.ToLower(repoName),Mode:mode,})}