mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 05:00:24 +08:00 
			
		
		
		
	优化从API实现代码中提取角色的方法
This commit is contained in:
		
							
								
								
									
										7549
									
								
								build/rpc.json
									
									
									
									
									
								
							
							
						
						
									
										7549
									
								
								build/rpc.json
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -160,7 +160,19 @@ func main() {
 | 
			
		||||
						roles = append(roles, "admin")
 | 
			
		||||
					}
 | 
			
		||||
					if strings.Contains(methodSource, ".ValidateAdminAndUser(") {
 | 
			
		||||
						roles = append(roles, "admin", "user")
 | 
			
		||||
						var hasRoles = false
 | 
			
		||||
						var wordIndex = strings.Index(methodSource, ".ValidateAdminAndUser(")
 | 
			
		||||
						if wordIndex > 0 {
 | 
			
		||||
							if len(methodSource[wordIndex:]) > 100 {
 | 
			
		||||
								if strings.Contains(methodSource[wordIndex:wordIndex+100], ".ValidateAdminAndUser(ctx, false)") {
 | 
			
		||||
									roles = append(roles, "admin")
 | 
			
		||||
									hasRoles = true
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
							if !hasRoles {
 | 
			
		||||
								roles = append(roles, "admin", "user")
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					if strings.Contains(methodSource, ".ValidateNSNode(") {
 | 
			
		||||
						roles = append(roles, "dns")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user