Skip to content

Commit

Permalink
Add missing role conditions getter
Browse files Browse the repository at this point in the history
  • Loading branch information
kimlisa committed Nov 4, 2024
1 parent 13cf50c commit 2c9c06d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions api/types/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ type Role interface {
// SetNamespaces sets a list of namespaces this role is allowed or denied access to.
SetNamespaces(RoleConditionType, []string)

// GetRoleConditions gets the RoleConditions for the RoleConditionType.
GetRoleConditions(rct RoleConditionType) RoleConditions

// GetLabelMatchers gets the LabelMatchers that match labels of resources of
// type [kind] this role is allowed or denied access to.
GetLabelMatchers(rct RoleConditionType, kind string) (LabelMatchers, error)
Expand Down Expand Up @@ -1720,6 +1723,16 @@ func (r *RoleV6) GetPreviewAsRoles(rct RoleConditionType) []string {
return roleConditions.ReviewRequests.PreviewAsRoles
}

// GetRoleConditions returns the role conditions for the role.
func (r *RoleV6) GetRoleConditions(rct RoleConditionType) RoleConditions {
roleConditions := r.Spec.Allow
if rct == Deny {
roleConditions = r.Spec.Deny
}

return roleConditions
}

// SetPreviewAsRoles sets the list of extra roles which should apply to a
// reviewer while they are viewing a Resource Access Request for the
// purposes of viewing details such as the hostname and labels of requested
Expand Down

0 comments on commit 2c9c06d

Please sign in to comment.