add isPermissionMethod #8
No reviewers
Labels
No Label
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Selly-Modules/usermngmt#8
Loading…
Reference in New Issue
No description provided.
Delete Branch "feature/isPermission"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
sai text
check
@ -322,0 +334,4 @@logger.Error("usermngmt - HasPermission: email or password cannot be empty", logger.LogData{"userID": userID,"permission": permission,})func này muốn nhanh thì làm thêm in-memory cache (https://github.com/allegro/bigcache) như sau:
@ -322,0 +334,4 @@logger.Error("usermngmt - HasPermission: email or password cannot be empty", logger.LogData{"userID": userID,"permission": permission,})done
done
@ -51,3 +56,4 @@//// Role//gom code if
check
đặt constant phía trên luôn
không nên làm ntn, vì call db khá nhiều
@ -322,0 +368,4 @@}if _, isValid := funk.FindString(cachedRole.Permissions, func(s string) bool {return s == permission}); isValid {chỗ này thiếu
cachephải có 1 hàmGetCachedRolestrả vềCachedRoles, trong hàm đó nếu checkcachedRoles = nilthì phải call hàmRolesđể tạo cache mớiGetCachedRoles2 bước 2,3 nên đưa ra 1 func
checkUserHasPermissionFromCacheđể làm cho gọn code@ -54,6 +55,9 @@ func Init(config Config) (*Service, error) {return nil, errfunc này gọi trong hàm Init của
cacheluôn@ -54,6 +55,9 @@ func Init(config Config) (*Service, error) {return nil, errdone
@ -322,0 +368,4 @@}if _, isValid := funk.FindString(cachedRole.Permissions, func(s string) bool {return s == permission}); isValid {done
done
done
@ -51,3 +56,4 @@//// Role//done
đặt tên biến lại chớ trùng với tên package rồi,
mc(mem-cache)check
done