mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-07 07:10:25 +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")
|
roles = append(roles, "node")
|
||||||
}
|
}
|
||||||
if strings.Contains(methodSource, ".ValidateUserNode(") {
|
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(") {
|
if strings.Contains(methodSource, ".ValidateAdmin(") {
|
||||||
roles = append(roles, "admin")
|
roles = append(roles, "admin")
|
||||||
|
|||||||
Reference in New Issue
Block a user