fixed multiple roles in 1 policy

This commit is contained in:
2025-12-15 13:24:16 +08:00
parent 5743dbf22d
commit 15deba4584
6 changed files with 79 additions and 84 deletions
+7 -8
View File
@@ -77,12 +77,11 @@ type AuthorizationResult struct {
// CachedAuthorizationService adds caching layer to authorization
type CachedAuthorizationService struct {
Repo interface{} // repository.PermissionRepository
PermissionCache map[string]*Permission // key: "resource:action"
PolicyCache map[int][]PolicyAttribute
UserAttrCache map[string]map[string]string // key: userID
CacheMutex interface{} // sync.RWMutex
UserAttrMutex interface{} // sync.RWMutex
CacheExpiry time.Duration
LastCacheRefresh time.Time
PermissionCache map[string]*Permission `json:"-"` // key: "resource:action"
PolicyCache map[int][]PolicyAttribute `json:"-"`
UserAttrCache map[string]map[string]string `json:"-"` // key: userID
CacheMutex interface{} `json:"-"` // sync.RWMutex
UserAttrMutex interface{} `json:"-"` // sync.RWMutex
CacheExpiry time.Duration `json:"cache_expiry"`
LastCacheRefresh time.Time `json:"last_cache_refresh"`
}