2025-10-29 15:09:22: merge [main:2637770d8299ca2f29cca8cba4524bb3865137cd];

This commit is contained in:
txix committed 2025-10-29 15:09:22 +03:00
1 parent 71a841fee0
commit 88e5ffedad
6 files changed
+17 -6

No files matched your search

+1 -1
View File
@@ -1 +1 @@
6.6.0
6.6.1
+2
View File
@@ -1,3 +1,5 @@
### v6.6.1
* Добавлено поле `roleNames` в метод `admin/user/get_profile`
### v6.6.0
* Добавлено отдельное событие 'user_blocked' для блокировки/разблокировки пользователей
* Обновлены зависимости
+4 -3
View File
@@ -33,6 +33,10 @@ definitions:
type: array
role:
type: string
roleNames:
items:
type: string
type: array
roles:
items:
type: integer
@@ -233,7 +237,6 @@ definitions:
domain.SecureAuthResponse:
properties:
adminId:
format: int64
type: integer
authenticated:
type: boolean
@@ -315,7 +318,6 @@ definitions:
firstName:
type: string
id:
format: int64
type: integer
lastName:
type: string
@@ -334,7 +336,6 @@ definitions:
type: string
ids:
items:
format: int64
type: integer
type: array
limit:
+1
View File
@@ -34,6 +34,7 @@ type AdminUserShort struct {
Email string `validate:"required"`
Role string
Roles []int
RoleNames []string
Permissions []string
IdleTimeoutMs int
}
+7 -2
View File
@@ -105,8 +105,9 @@ func (u User) GetProfileById(ctx context.Context, userId int64) (*domain.AdminUs
roleIds := RolesIds(roles)
var (
roleList []entity.Role
roleName string
roleList []entity.Role
roleName string
roleNames []string
)
if len(roleIds) != 0 {
roleList, err = u.roleRepoUser.GetRoleByIds(ctx, roleIds)
@@ -115,6 +116,9 @@ func (u User) GetProfileById(ctx context.Context, userId int64) (*domain.AdminUs
}
if len(roleList) > 0 {
roleName = roleList[0].Name
for _, r := range roleList {
roleNames = append(roleNames, r.Name)
}
}
}
@@ -124,6 +128,7 @@ func (u User) GetProfileById(ctx context.Context, userId int64) (*domain.AdminUs
Email: user.Email,
Role: roleName,
Roles: roleIds,
RoleNames: roleNames,
IdleTimeoutMs: u.idleTimeoutMs,
Permissions: mergePermissions(roleList),
}, nil
+2
View File
@@ -99,6 +99,7 @@ func (s *UserTestSuite) TestGetProfileHappyPath() {
Email: "a@a.ru",
Role: "admin",
Roles: []int{1},
RoleNames: []string{"admin"},
Permissions: []string{},
}
s.Require().Equal(expected, response)
@@ -151,6 +152,7 @@ func (s *UserTestSuite) TestGetProfileSudir() {
Email: "a@b.ru",
Role: "admin",
Roles: []int{1},
RoleNames: []string{"admin"},
Permissions: []string{},
}
s.Require().Equal(expected, response)