small fix
This commit is contained in:
@@ -81,7 +81,7 @@ func (h *ProductTranslationHandler) SaveProductDescription(c fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
userRole, ok := localeExtractor.GetOriginalUserRole(c)
|
userRole, ok := localeExtractor.GetOriginalUserRole(c)
|
||||||
if !ok || userRole != model.RoleAdmin {
|
if !ok || model.CustomerRole(userRole.Name) != model.RoleAdmin {
|
||||||
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrAdminAccessRequired)).
|
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrAdminAccessRequired)).
|
||||||
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrAdminAccessRequired)))
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrAdminAccessRequired)))
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ func (h *ProductTranslationHandler) TranslateProductDescription(c fiber.Ctx) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
userRole, ok := localeExtractor.GetOriginalUserRole(c)
|
userRole, ok := localeExtractor.GetOriginalUserRole(c)
|
||||||
if !ok || userRole != model.RoleAdmin {
|
if !ok || model.CustomerRole(userRole.Name) != model.RoleAdmin {
|
||||||
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrAdminAccessRequired)).
|
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrAdminAccessRequired)).
|
||||||
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrAdminAccessRequired)))
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrAdminAccessRequired)))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func (h *MeiliSearchHandler) CreateIndex(c fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
userRole, ok := localeExtractor.GetOriginalUserRole(c)
|
userRole, ok := localeExtractor.GetOriginalUserRole(c)
|
||||||
if !ok || userRole != model.RoleAdmin {
|
if !ok || model.CustomerRole(userRole.Name) != model.RoleAdmin {
|
||||||
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrAdminAccessRequired)).
|
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrAdminAccessRequired)).
|
||||||
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrAdminAccessRequired)))
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrAdminAccessRequired)))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ func (h *StorageHandler) CreateNewWebdavToken(c fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
userRole, ok := localeExtractor.GetOriginalUserRole(c)
|
userRole, ok := localeExtractor.GetOriginalUserRole(c)
|
||||||
if !ok || userRole != model.RoleAdmin {
|
if !ok || model.CustomerRole(userRole.Name) != model.RoleAdmin {
|
||||||
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrAdminAccessRequired)).
|
return c.Status(responseErrors.GetErrorStatus(responseErrors.ErrAdminAccessRequired)).
|
||||||
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrAdminAccessRequired)))
|
JSON(response.Make(nullable.GetNil(""), 0, responseErrors.GetErrorCode(c, responseErrors.ErrAdminAccessRequired)))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user