changed role permission
This commit is contained in:
1 parent
f0ecf23879
commit
323e131216
74 files changed
+2915
-4713
No files matched your search
@@ -9,6 +9,7 @@ import (
|
||||
"online-back/internal/appresult"
|
||||
"online-back/internal/handlers"
|
||||
"online-back/internal/identity/rbac"
|
||||
"online-back/internal/identity/rbac/perm"
|
||||
"online-back/internal/org/province"
|
||||
"online-back/internal/shared"
|
||||
"online-back/pkg/logging"
|
||||
@@ -30,7 +31,7 @@ func NewHandler(logger *logging.Logger, repository Repository, provinces provinc
|
||||
}
|
||||
|
||||
func (h *handler) Register(router *gin.RouterGroup) {
|
||||
group := router.Group(baseURL, appresult.JwtTokenCheck())
|
||||
group := rbac.Group(router, baseURL, rbac.Catalog(perm.Branches))
|
||||
group.GET("", h.list)
|
||||
group.GET("/regions", h.listRegions)
|
||||
group.GET("/etraps", h.listEtraps)
|
||||
@@ -69,7 +70,7 @@ func (h *handler) list(c *gin.Context) {
|
||||
c.JSON(http.StatusInternalServerError, appresult.ErrInternalServer)
|
||||
return
|
||||
}
|
||||
if !rbac.IsAdminGuard(c) {
|
||||
if !rbac.HasAllScope(c) {
|
||||
for i := range result.Branches {
|
||||
clearBranchSecrets(&result.Branches[i])
|
||||
}
|
||||
@@ -173,7 +174,7 @@ func (h *handler) getByID(c *gin.Context) {
|
||||
if !rbac.GuardBranch(c, item.Id) {
|
||||
return
|
||||
}
|
||||
if !rbac.IsAdminGuard(c) {
|
||||
if !rbac.HasAllScope(c) {
|
||||
clearBranchSecrets(&item)
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
|
||||
"online-back/internal/appresult"
|
||||
"online-back/internal/handlers"
|
||||
"online-back/internal/identity/rbac"
|
||||
"online-back/internal/identity/rbac/perm"
|
||||
"online-back/internal/shared"
|
||||
"online-back/pkg/logging"
|
||||
|
||||
@@ -27,7 +29,7 @@ func NewHandler(logger *logging.Logger, repository Repository) handlers.Handler
|
||||
}
|
||||
|
||||
func (h *handler) Register(router *gin.RouterGroup) {
|
||||
group := router.Group(baseURL, appresult.JwtTokenCheck())
|
||||
group := rbac.Group(router, baseURL, rbac.Catalog(perm.Provinces))
|
||||
group.GET("", h.list)
|
||||
// Use /branches/regions and /branches/etraps instead.
|
||||
// group.GET("/regions", h.listRegions)
|
||||
|
||||
Reference in new issue
Block a user