new features
This commit is contained in:
@@ -140,7 +140,7 @@ func (h *PositionsHandler) RemovePermissionFromPosition(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (h *PositionsHandler) ListPermissions(c *gin.Context) {
|
||||
perms, err := h.svc.GetAllPermissions(c.Request.Context())
|
||||
perms, err := h.svc.GetAllPermissionsForLocale(c.Request.Context(), localeFromRequest(c))
|
||||
if err != nil {
|
||||
c.Error(models.ErrInternal)
|
||||
return
|
||||
@@ -149,6 +149,16 @@ func (h *PositionsHandler) ListPermissions(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, perms)
|
||||
}
|
||||
|
||||
func (h *PositionsHandler) ListUsersWithPositions(c *gin.Context) {
|
||||
users, err := h.svc.GetUsersWithPositions(c.Request.Context(), localeFromRequest(c))
|
||||
if err != nil {
|
||||
c.Error(models.ErrInternal)
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, users)
|
||||
}
|
||||
|
||||
func (h *PositionsHandler) AssignPosition(c *gin.Context) {
|
||||
adminID, ok := userIDFromContext(c)
|
||||
if !ok {
|
||||
@@ -201,7 +211,7 @@ func (h *PositionsHandler) CreatePermission(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := h.svc.CreatePermission(c.Request.Context(), req.Code, req.Description); err != nil {
|
||||
if err := h.svc.CreatePermission(c.Request.Context(), req.Code, localeFromRequest(c), req.Description); err != nil {
|
||||
c.Error(err)
|
||||
return
|
||||
}
|
||||
@@ -218,7 +228,7 @@ func (h *PositionsHandler) UpdatePermission(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := h.svc.UpdatePermission(c.Request.Context(), c.Param("code"), req.Description); err != nil {
|
||||
if err := h.svc.UpdatePermission(c.Request.Context(), c.Param("code"), localeFromRequest(c), req.Description); err != nil {
|
||||
c.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user