AuthZService: Cache folder tree (#98210)

* AuthZService: Cache folder tree

* Remove fmt

* Suggestion

* Add tests
This commit is contained in:
Gabriel MABILLE
2024-12-19 13:55:59 +01:00
committed by GitHub
parent 6c5b408339
commit c175722dfd
3 changed files with 113 additions and 7 deletions
+9 -7
View File
@@ -1,23 +1,25 @@
package rbac
import "fmt"
func userIdentifierCacheKey(namespace, userUID string) string {
return fmt.Sprintf("UID_%s_%s", namespace, userUID)
return "UID_" + namespace + "_" + userUID
}
func userIdentifierCacheKeyById(namespace, ID string) string {
return fmt.Sprintf("ID_%s_%s", namespace, ID)
return "ID_" + namespace + "_" + ID
}
func userPermCacheKey(namespace, userUID, action string) string {
return fmt.Sprintf("%s_%s_%s", namespace, userUID, action)
return namespace + "_" + userUID + "_" + action
}
func userBasicRoleCacheKey(namespace, userUID string) string {
return fmt.Sprintf("%s_%s", namespace, userUID)
return namespace + "_" + userUID
}
func userTeamCacheKey(namespace, userUID string) string {
return fmt.Sprintf("%s_%s", namespace, userUID)
return namespace + "_" + userUID
}
func folderCacheKey(namespace string) string {
return namespace
}