MSP-2243 update role
This commit is contained in:
1 parent
61bdaeaa3d
commit
df15ae228a
4 files changed
+8
-2
No files matched your search
@@ -10,6 +10,8 @@ type Role struct {
|
||||
ExternalGroup string
|
||||
ChangeMessage string
|
||||
Permissions []string
|
||||
Immutable bool
|
||||
Exclusive bool
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ type Role struct {
|
||||
Name string
|
||||
ExternalGroup string
|
||||
Permissions PermList
|
||||
Immutable bool
|
||||
Exclusive bool
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
+2
-2
@@ -96,9 +96,9 @@ func (r Role) GetRoleByExternalGroup(ctx context.Context, group string) (*entity
|
||||
|
||||
func (r Role) All(ctx context.Context) ([]entity.Role, error) {
|
||||
sql_metrics.OperationLabelToContext(ctx, "Role.All")
|
||||
|
||||
q := "select id, name, external_group, permissions, immutable, exclusive, created_at, updated_at from roles order by created_at"
|
||||
roles := make([]entity.Role, 0)
|
||||
err := r.db.Select(ctx, &roles, "select id, name, external_group, permissions, created_at, updated_at from roles order by created_at")
|
||||
err := r.db.Select(ctx, &roles, q)
|
||||
if err != nil {
|
||||
return nil, errors.WithMessage(err, "select all roles")
|
||||
}
|
||||
|
||||
@@ -130,6 +130,8 @@ func (u Role) toDomain(role entity.Role) domain.Role {
|
||||
Name: role.Name,
|
||||
ExternalGroup: role.ExternalGroup,
|
||||
Permissions: role.Permissions,
|
||||
Immutable: role.Immutable,
|
||||
Exclusive: role.Exclusive,
|
||||
CreatedAt: role.CreatedAt,
|
||||
UpdatedAt: role.UpdatedAt,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user