mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 13:10:24 +08:00 
			
		
		
		
	优化API角色提取
This commit is contained in:
		
							
								
								
									
										7656
									
								
								build/rpc.json
									
									
									
									
									
								
							
							
						
						
									
										7656
									
								
								build/rpc.json
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -154,7 +154,18 @@ func main() {
 | 
			
		||||
						roles = append(roles, "node")
 | 
			
		||||
					}
 | 
			
		||||
					if strings.Contains(methodSource, ".ValidateUserNode(") {
 | 
			
		||||
						roles = append(roles, "user")
 | 
			
		||||
						var hasRoles = false
 | 
			
		||||
						var wordIndex = strings.Index(methodSource, ".ValidateUserNode(")
 | 
			
		||||
						if wordIndex > 0 {
 | 
			
		||||
							if len(methodSource[wordIndex:]) > 100 {
 | 
			
		||||
								if strings.Contains(methodSource[wordIndex:wordIndex+100], ".ValidateUserNode(ctx, false)") {
 | 
			
		||||
									hasRoles = true
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
							if !hasRoles {
 | 
			
		||||
								roles = append(roles, "user")
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					if strings.Contains(methodSource, ".ValidateAdmin(") {
 | 
			
		||||
						roles = append(roles, "admin")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user