#1575 Limit repo creation

This commit is contained in:
Unknwon 2015-12-10 12:37:53 -05:00
parent c6083c335e
commit 2a0bb1fa90
15 changed files with 73 additions and 14 deletions

View file

@ -900,6 +900,10 @@ func createRepository(e *xorm.Session, u *User, repo *Repository) (err error) {
// CreateRepository creates a repository for given user or organization.
func CreateRepository(u *User, opts CreateRepoOptions) (_ *Repository, err error) {
if !u.CanCreateRepo() {
return nil, ErrReachLimitOfRepo{u.MaxRepoCreation}
}
repo := &Repository{
OwnerID: u.Id,
Owner: u,