Skip to content

Commit

Permalink
Add reviewer role
Browse files Browse the repository at this point in the history
  • Loading branch information
tcsc committed Dec 13, 2024
1 parent 16b5f33 commit 4347058
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/services/presets.go
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ func defaultAllowAccessReviewConditions(enterprise bool) map[string]*types.Acces
Roles: []string{
teleport.PresetAccessRoleName,
teleport.PresetGroupAccessRoleName,
teleport.SystemIdentityCenterAccessRoleName,
},
},
}
Expand Down Expand Up @@ -946,6 +947,7 @@ func applyAccessRequestConditionDefaults(role types.Role, enterprise bool) bool
target = *defaults
changed = true
} else {
target.Roles = mergeStrings(target.Roles, defaults.Roles, &changed)
target.SearchAsRoles = mergeStrings(target.SearchAsRoles, defaults.SearchAsRoles, &changed)
}

Expand All @@ -968,6 +970,7 @@ func applyAccessReviewConditionDefaults(role types.Role, enterprise bool) bool {
target = *defaults
changed = true
} else {
target.Roles = mergeStrings(target.Roles, defaults.Roles, &changed)
target.PreviewAsRoles = mergeStrings(target.PreviewAsRoles, defaults.PreviewAsRoles, &changed)
}

Expand Down
7 changes: 6 additions & 1 deletion lib/services/presets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,12 @@ func TestAddRoleDefaults(t *testing.T) {
Spec: types.RoleSpecV6{
Allow: types.RoleConditions{
ReviewRequests: &types.AccessReviewConditions{
Roles: []string{"some-role"},
Roles: []string{
teleport.PresetAccessRoleName,
teleport.SystemIdentityCenterAccessRoleName,
teleport.PresetGroupAccessRoleName,
"some-role",
},
PreviewAsRoles: []string{
teleport.PresetAccessRoleName,
teleport.SystemIdentityCenterAccessRoleName,
Expand Down

0 comments on commit 4347058

Please sign in to comment.