mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 10:44:12 +01:00 
			
		
		
		
	#1301 "read-only" users
This commit is contained in:
		
							parent
							
								
									2a0bb1fa90
								
							
						
					
					
						commit
						df5ed64cca
					
				@ -857,7 +857,7 @@ users.password_helper = Leave it empty to remain unchanged.
 | 
				
			|||||||
users.update_profile_success = Account profile has been updated successfully.
 | 
					users.update_profile_success = Account profile has been updated successfully.
 | 
				
			||||||
users.edit_account = Edit Account
 | 
					users.edit_account = Edit Account
 | 
				
			||||||
users.max_repo_creation = Maximum Repository Creation Limit
 | 
					users.max_repo_creation = Maximum Repository Creation Limit
 | 
				
			||||||
users.max_repo_creation_desc = (Set 0 to use gloabl default limit)
 | 
					users.max_repo_creation_desc = (Set -1 to use gloabl default limit)
 | 
				
			||||||
users.is_activated = This account is activated
 | 
					users.is_activated = This account is activated
 | 
				
			||||||
users.is_admin = This account has administrator permissions
 | 
					users.is_admin = This account has administrator permissions
 | 
				
			||||||
users.allow_git_hook = This account has permissions to create Git hooks
 | 
					users.allow_git_hook = This account has permissions to create Git hooks
 | 
				
			||||||
 | 
				
			|||||||
@ -104,8 +104,8 @@ type User struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (u *User) BeforeUpdate() {
 | 
					func (u *User) BeforeUpdate() {
 | 
				
			||||||
	if u.MaxRepoCreation < 0 {
 | 
						if u.MaxRepoCreation < -1 {
 | 
				
			||||||
		u.MaxRepoCreation = 0
 | 
							u.MaxRepoCreation = -1
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -125,14 +125,14 @@ func (u *User) HasForkedRepo(repoID int64) bool {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (u *User) RepoCreationNum() int {
 | 
					func (u *User) RepoCreationNum() int {
 | 
				
			||||||
	if u.MaxRepoCreation == 0 {
 | 
						if u.MaxRepoCreation <= -1 {
 | 
				
			||||||
		return setting.Repository.MaxCreationLimit
 | 
							return setting.Repository.MaxCreationLimit
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return u.MaxRepoCreation
 | 
						return u.MaxRepoCreation
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (u *User) CanCreateRepo() bool {
 | 
					func (u *User) CanCreateRepo() bool {
 | 
				
			||||||
	if u.MaxRepoCreation == 0 {
 | 
						if u.MaxRepoCreation <= -1 {
 | 
				
			||||||
		return u.NumRepos < setting.Repository.MaxCreationLimit
 | 
							return u.NumRepos < setting.Repository.MaxCreationLimit
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return u.NumRepos < u.MaxRepoCreation
 | 
						return u.NumRepos < u.MaxRepoCreation
 | 
				
			||||||
 | 
				
			|||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user