Skip to content

Commit

Permalink
return true if both allowed is false and denied is false in SubjectAc… (
Browse files Browse the repository at this point in the history
#132)

* return true if both allowed is false and denied is false in SubjectAccessReviewSpec result

Signed-off-by: Xiangjing Li <xiangli@redhat.com>

* remain the default return value is true

Signed-off-by: Xiangjing Li <xiangli@redhat.com>
  • Loading branch information
xiangjingli authored Mar 21, 2022
1 parent 0106601 commit e528cdd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/placementrule/controller/placementrule/placement.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,13 @@ func (r *ReconcilePlacementRule) checkUserPermission(annotations map[string]stri
return false
}

// According to https://docs.openshift.com/container-platform/4.9/rest_api/authorization_apis/subjectaccessreview-authorization-k8s-io-v1.html
// If both allowed is false and denied is false, then the authorizer has no opinion on whether to authorize the action
// We should return true in this case
if !result.Status.Allowed && !result.Status.Denied {
return true
}

if !result.Status.Allowed {
return false
}
Expand Down

0 comments on commit e528cdd

Please sign in to comment.