Add Duo pro bulk assigning users service
What does this MR do and why?
This MR addresses bulk Duo Pro user assignments:
- Add a service for bulk assigning users to Duo Pro
- Implements early return for insufficient seats (
NOT_ENOUGH_SEATS
error). - Introduces fast-fail for invalid user IDs (
INVALID_USER_ID_PRESENT
error). - Aligns with the agreed-upon approach for consistency !146104 (comment 1808949111), maintaining a consistent
all or none
approach.
Success Response:
Click to expand
<ServiceResponse:0x000000028cd7b908
@http_status=:ok,
@message=nil,
@payload=
{:users=>
[#<User id:12906 @code_suggestions_user1>,
#<User id:12907 @code_suggestions_user2>,
#<User id:12908 @code_suggestions_user3>,
#<User id:12909 @code_suggestions_user4>,
#<User id:12910 @code_suggestions_user5>,
#<User id:12911 @code_suggestions_user6>,
#<User id:12912 @code_suggestions_user7>,
#<User id:12913 @code_suggestions_user8>,
#<User id:12914 @code_suggestions_user9>,
#<User id:12915 @code_suggestions_user10>,
#<User id:12916 @code_suggestions_user11>,
#<User id:12917 @code_suggestions_user12>,
#<User id:12918 @code_suggestions_user13>,
#<User id:12919 @code_suggestions_user14>,
#<User id:12920 @code_suggestions_user15>,
#<User id:12921 @code_suggestions_user16>,
#<User id:12922 @code_suggestions_user17>,
#<User id:12923 @code_suggestions_user18>,
#<User id:12924 @code_suggestions_user19>,
#<User id:12925 @code_suggestions_user20>]
@reason=nil,
@status=:success>
No enough seats Response:
Click to expand
#<ServiceResponse:0x00000002957f4080
@http_status=nil,
@message=
"NOT_ENOUGH_SEATS",
@payload={},
@reason=nil,
@status=:error>
OR
#<ServiceResponse:0x00000002957f4080
@http_status=nil,
@message=
"INVAILD_USER_ID_PRESENT",
@payload={},
@reason=nil,
@status=:error>
Related to #442284
Edited by Mohamed Hamda