Add backups, currencies and dashboard APIs, and scope access by guard_name.
Web users may only CRUD their own records, operators stay in assigned branches, and admin/manager/superadmin keep full access. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0d000f9af6
commit
28509eb4ca
65 files changed
+9132
-296
No files matched your search
@@ -250,12 +250,24 @@ func parseListFilter(c *gin.Context) (ListFilter, bool) {
|
||||
filter.PassportId = raw
|
||||
}
|
||||
|
||||
raw := strings.TrimSpace(c.Query("user_id"))
|
||||
if raw == "" {
|
||||
raw = strings.TrimSpace(c.Query("userId"))
|
||||
}
|
||||
if raw != "" {
|
||||
id, ok := parseID(raw)
|
||||
if !ok {
|
||||
return ListFilter{}, false
|
||||
}
|
||||
filter.UserId = &id
|
||||
}
|
||||
|
||||
rbac.BindBranchIDs(c, &filter.BranchIds)
|
||||
return filter, true
|
||||
}
|
||||
|
||||
func (h *handler) guardUserByID(c *gin.Context, id int64) bool {
|
||||
if !rbac.HasBranchScope(c) {
|
||||
if rbac.SkipRecordGuard(c) {
|
||||
return true
|
||||
}
|
||||
item, err := h.repository.GetByID(c.Request.Context(), id)
|
||||
|
||||
Reference in new issue
Block a user