@ -7,13 +7,13 @@ Gogs (Go Git Service) is a painless self-hosted Git service written in Go.
![Demo](http://gogs.qiniudn.com/gogs_demo.gif)
![Demo](http://gogs.qiniudn.com/gogs_demo.gif)
##### Current version: 0.5.13 Beta
##### Current version: 0.5.16 Beta
### NOTICES
### NOTICES
- Due to testing purpose, data of [try.gogs.io](https://try.gogs.io) has been reset in **Jan 28, 2015** and will reset multiple times after. Please do **NOT** put your important data on the site.
- Due to testing purpose, data of [try.gogs.io](https://try.gogs.io) has been reset in **Jan 28, 2015** and will reset multiple times after. Please do **NOT** put your important data on the site.
- The demo site [try.gogs.io](https://try.gogs.io) is running under `dev` branch.
- The demo site [try.gogs.io](https://try.gogs.io) is running under `dev` branch.
- You **MUST** read [CONTRIBUTING.md](CONTRIBUTING.md) before you start filing a issue or making a Pull Request.
- You **MUST** read [CONTRIBUTING.md](CONTRIBUTING.md) before you start filing an issue or making a Pull Request.
- If you think there are vulnerabilities in the project, please talk privately to **u@gogs.io**. Thanks!
- If you think there are vulnerabilities in the project, please talk privately to **u@gogs.io**. Thanks!
#### Other language version
#### Other language version
@ -57,7 +57,7 @@ The goal of this project is to make the easiest, fastest, and most painless way
## System Requirements
## System Requirements
- A cheap Raspberry Pi is powerful enough for basic functionality.
- A cheap Raspberry Pi is powerful enough for basic functionality.
- At least 4 CPU cores and 1GB RAM would be the baseline for teamwork.
- At least 2 CPU cores and 1GB RAM would be the baseline for teamwork.
results,err:=x.Query("SELECT u.id AS `uid`, a.repo_name AS `repo`, a.mode AS `mode`, a.created as `created` FROM `access` a JOIN `user` u ON a.user_name=u.lower_name")
results,err:=sess.Query("SELECT u.id as `uid`, ou.uid as `memberid` FROM `user` u LEFT JOIN org_user ou ON ou.org_id=u.id WHERE u.lower_name=?",ownerName)
// We can skip all cases that a user is member of the owning organization
ifmemberID==userID{
isMember=true
}
}
ifisMember{
continue
}
results,err=sess.Query("SELECT id FROM `repository` WHERE owner_id=? AND lower_name=?",ownerID,repoName)
iferr!=nil{
returnerr
}elseiflen(results)<1{
continue
}
collaboration:=&Collaboration{
UserID:userID,
RepoID:com.StrTo(results[0]["id"]).MustInt64(),
}
has,err:=sess.Get(collaboration)
iferr!=nil{
returnerr
}elseifhas{
continue
}
collaboration.Created=created
if_,err=sess.InsertOne(collaboration);err!=nil{
returnerr
}
}
returnsess.Commit()
}
funcownerTeamUpdate(x*xorm.Engine)(errerror){
if_,err:=x.Exec("UPDATE `team` SET authorize=4 WHERE lower_name=?","owners");err!=nil{
returnfmt.Errorf("update owner team table: %v",err)
}
returnnil
}
funcaccessRefactor(x*xorm.Engine)(errerror){
type(
AccessModeint
Accessstruct{
IDint64`xorm:"pk autoincr"`
UserIDint64`xorm:"UNIQUE(s)"`
RepoIDint64`xorm:"UNIQUE(s)"`
ModeAccessMode
}
UserRepostruct{
UserIDint64
RepoIDint64
}
)
// We consiously don't start a session yet as we make only reads for now, no writes
accessMap:=make(map[UserRepo]AccessMode,50)
results,err:=x.Query("SELECT r.id AS `repo_id`, r.is_private AS `is_private`, r.owner_id AS `owner_id`, u.type AS `owner_type` FROM `repository` r LEFT JOIN `user` u ON r.owner_id=u.id")
// because public repository has implicit open access.
minAccessLevel:=AccessMode(0)
if!isPrivate{
minAccessLevel=1
}
repoString:="$"+string(repo["repo_id"])+"|"
results,err=x.Query("SELECT `id`,`authorize`,`repo_ids` FROM `team` WHERE org_id=? AND authorize>? ORDER BY `authorize` ASC",ownerID,int(minAccessLevel))