Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v14] Add access request promotion state and suggestion API changes (#…
…32710) * Generate access list allowed promotions on access request creation (#31768) * Generate access list suggestions on access request creation * Add test Cleanup code * Add comment * Fix typo and refactor access suggestion in services library Fixed a typo in a comment in `access_list.go`. Refactored `accessrequest/suggestion.go` for enhanced code structure. The old model had all methods related to access request in a single interface, `accessRequestAPIGetter`, which had been divided among multiple interfaces for better division of responsibilities. A new function `GetSuggestedAccessLists` was created to narrow down the single duty for each function. These changes ensure more convenient unit testing and better accountability. * Improve access request suggestions logic This commit improves the logic for generating access request suggestions. It includes the requester's roles and traits as well as those from the access list and provides suggestions only for resource-based requests. A new method was also introduced for initializing AccessRequestSuggestions to avoid nil error. * Refactor access list suggestions to promotions The concept of 'suggestions' was updated to 'promotions' in different files (auth.go, client.go, auth_service_test.go, auth_service.proto among others) to make it more intuitive and align with the business context. This implies changing the wording, the functions called and the variable names. The feature itself hasn't changed, just the way it is referred. * This commit changes the method name "GenerateAccessListSuggestions" to "GenerateAccessRequestPromotions" in multiple files. The naming is changed to reflect the actual function of the method, which is generating promotions for given access requests, rather than generating list suggestions. All relevant mentions and usages of this method are updated to reflect the name change. Modification also includes adjustments to the comments and interfaces related to the updated function for better code clarity. * Refactor "GenerateAccessListSuggestions" to "GenerateAccessRequestPromotions" Renamed method "GenerateAccessListSuggestions" to "GenerateAccessRequestPromotions" across the codebase. This change reflects the actual functionality of the method, which is to generate promotions for access requests, not suggestions. This aligns the method name with its purpose, and offers better code readability. Comments related to this function were also updated to maintain consistency. * Update method handling access requests promotions Revised the method of handling failures when generating access requests promotions. Now, even if promotions fail to generate, the request will not fail entirely. Instead, the request can still be approved but without promotions. Also, changed the UpsertAccessRequestAllowedPromotions method to CreateAccessRequestAllowedPromotions to clearly indicate its purpose, while revising related test cases and comments. * Add 'promoted' access request state (#31346) * This change introduces a new 'promoted' access request state. The state represents that an access request has been promoted to an access list. Affected code was modified to adjust to the new promoted state and ensure correct system's behavior. Added a new 'GetAccessRequest' method for internal use to retrieve access request info. Disallowed direct promotion of access requests. Introduced 'SubmitAccessReviewAllowPromotion' for promotions. Added 'PromoteAccessRequest' method and updated its usage to restrict direct promotions. Refactored code for better readability and testing. Renamed some functions, simplified logic, added test helpers. Introduced 'promoted' state for access requests to handle promotion workflow. Added 'PromotedAccessListTitle' in 'AccessReview' to track promotion state. * Refactor function and message names for better clarity The function and message names related to the promotion of an access request to an access list were restructured for better readability and consistency. Names like 'PromoteAccessReqResponse' have been replaced with more descriptive names such as 'PromoteAccessRequestResponse'. This increases clarity and consistency across the project. * Remove the hacky GRPC server implementation * Change method names to be more descriptive Renamed all instances of 'PromoteAccessRequest' to 'AccessRequestPromote' in multiple files. The new method name provides a more descriptive and clear understanding of the method's function, which improves code readability and maintenance. This change applies to method definitions, comments, and error messages. * Refine error message and introduce IsPromoted method Refined the error message in 'access_request.go' to better indicate that only promoted requests can set the promoted access list title, not just have one. This enhances clarity of error message. Additionally, introduced 'IsPromoted' method in 'access_request.go' file. This method will be useful for quickly checking if a request is in the PROMOTED state. * Rename variable in SubmitAccessReview method Renamed the variable "params" to "submission" in the 'SubmitAccessReview' function, in 'auth_with_roles.go' file. The name "submission" provides clearer indictation of its role in submitting access review. This enhances code readability and understandability. No logic changes were made during this update. * Add Access List title to access request. (#32618) * Add Access List title to access request. * Add test Squash some bugs
- Loading branch information