mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	ssh push support
This commit is contained in:
		@@ -76,7 +76,9 @@ func setEngine() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	//x.ShowDebug = true
 | 
						//x.ShowDebug = true
 | 
				
			||||||
	//orm.ShowErr = true
 | 
						//orm.ShowErr = true
 | 
				
			||||||
	//x.ShowSQL = true
 | 
						f, _ := os.Create("xorm.log")
 | 
				
			||||||
 | 
						orm.Logger = f
 | 
				
			||||||
 | 
						orm.ShowSQL = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//log.Trace("Initialized database -> %s", dbName)
 | 
						//log.Trace("Initialized database -> %s", dbName)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,7 +23,7 @@ func Create(req *http.Request, r render.Render) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: access check
 | 
						// TODO: access check
 | 
				
			||||||
	fmt.Println(req.FormValue("userId"), req.FormValue("name"))
 | 
						//fmt.Println(req.FormValue("userId"), req.FormValue("name"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	id, err := strconv.ParseInt(req.FormValue("userId"), 10, 64)
 | 
						id, err := strconv.ParseInt(req.FormValue("userId"), 10, 64)
 | 
				
			||||||
	if err == nil {
 | 
						if err == nil {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								serve.go
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								serve.go
									
									
									
									
									
								
							@@ -81,23 +81,23 @@ func runServ(*cli.Context) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	switch {
 | 
						switch {
 | 
				
			||||||
	case isWrite:
 | 
						case isWrite:
 | 
				
			||||||
		has, err := models.HasAccess(user.Name, repoName, COMMANDS_WRITE[verb])
 | 
							has, err := models.HasAccess(user.Name, repoName, models.AU_WRITABLE)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			println("Inernel error:", err)
 | 
								println("Inernel error:", err)
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if !has {
 | 
							if !has {
 | 
				
			||||||
			println("You have no right to access this repository")
 | 
								println("You have no right to write this repository")
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	case isRead:
 | 
						case isRead:
 | 
				
			||||||
		has, err := models.HasAccess(user.Name, repoName, COMMANDS_READONLY[verb])
 | 
							has, err := models.HasAccess(user.Name, repoName, models.AU_READABLE)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			println("Inernel error")
 | 
								println("Inernel error")
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if !has {
 | 
							if !has {
 | 
				
			||||||
			has, err = models.HasAccess(user.Name, repoName, COMMANDS_WRITE[verb])
 | 
								has, err = models.HasAccess(user.Name, repoName, models.AU_WRITABLE)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				println("Inernel error")
 | 
									println("Inernel error")
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user