-
Notifications
You must be signed in to change notification settings - Fork 4.8k
enable personal subject access review #1186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,9 +95,9 @@ type ResourceAccessReviewResponse struct { | |
| // Namespace is the namespace used for the access review | ||
| Namespace string `json:"namespace,omitempty"` | ||
| // Users is the list of users who can perform the action | ||
| Users []string `json:"users"` | ||
| UsersSlice []string `json:"users"` | ||
| // Groups is the list of groups who can perform the action | ||
| Groups []string `json:"groups"` | ||
| GroupsSlice []string `json:"groups"` | ||
| } | ||
|
|
||
| // ResourceAccessReview is a means to request a list of which users and groups are authorized to perform the | ||
|
|
@@ -148,7 +148,7 @@ type SubjectAccessReview struct { | |
| // User is optional. If both User and Groups are empty, the current authenticated user is used. | ||
| User string `json:"user"` | ||
| // Groups is optional. Groups is the list of groups to which the User belongs. | ||
| Groups []string `json:"groups"` | ||
| GroupsSlice []string `json:"groups"` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please, let us have a variable named "HomeSlice" at some point |
||
| // Content is the actual content of the request for create and update | ||
| Content kruntime.RawExtension `json:"content,omitempty"` | ||
| // ResourceName is the name of the resource being requested for a "get" or deleted for a "delete" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,3 +34,22 @@ func (c *subjectAccessReviews) Create(policy *authorizationapi.SubjectAccessRevi | |
| err = c.r.Post().Namespace(c.ns).Resource("subjectAccessReviews").Body(policy).Do().Into(result) | ||
| return | ||
| } | ||
|
|
||
| // rootSubjectAccessReviews implements RootSubjectAccessReviews interface | ||
| type rootSubjectAccessReviews struct { | ||
| r *Client | ||
| } | ||
|
|
||
| // newRootSubjectAccessReviews returns a rootSubjectAccessReviews | ||
| func newRootSubjectAccessReviews(c *Client) *rootSubjectAccessReviews { | ||
| return &rootSubjectAccessReviews{ | ||
| r: c, | ||
| } | ||
| } | ||
|
|
||
| // Create creates new policy. Returns the server's representation of the policy and error if one occurs. | ||
| func (c *rootSubjectAccessReviews) Create(policy *authorizationapi.SubjectAccessReview) (result *authorizationapi.SubjectAccessReviewResponse, err error) { | ||
| result = &authorizationapi.SubjectAccessReviewResponse{} | ||
| err = c.r.Post().Resource("subjectAccessReviews").Body(policy).Do().Into(result) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @smarterclayton I thought a single resource type couldn't be both namespace-scoped and root-scoped... won't this come across in the resthander as a root-scoped object?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Who knows, David should go test it. ----- Original Message -----
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ouch... No namespace tested here: https://github.com/openshift/origin/pull/1186/files#diff-ceeb743bcc1311585cd02eac76b1d048R326, with namespace tested here: https://github.com/openshift/origin/pull/1186/files#diff-ceeb743bcc1311585cd02eac76b1d048R315.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I should've phrased the question differently. I saw the mutterings upstream about the meaning of an empty namespace changing or getting more limited. I didn't know if using a non-namespaced call would be able to continue to mean query across all namespaces.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see no reason for it not to continue to mean that at this time. |
||
| return | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the rename?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the names match, then conversions get crazy as automatic attempts are made to map unlike types in defaultconversions. Different names allows stock usage of default conversion and makes any lapses in proper overlapping leap out during unit tests.