Closed jasonmimick closed 4 years ago
Questions:
Can we "automatically" add the user who is calling cf create-service ...
to the Atlas project that gets generated for the service being created? We would add parameters -c
to capture the email, e.g. -c {"email" : "dev@manulife.com"}
.
Users will need to pass their passwords on the cf create-service ...
call. Is this ok?
What role should the user be assigned in Atlas? Here are the options: GROUP_OWNER - Project Owner GROUP_CLUSTER_MANAGER - Project Cluster Manager GROUP_READ_ONLY - Project Read Only GROUP_DATA_ACCESS_ADMIN - Project Data Access Admin GROUP_DATA_ACCESS_READ_WRITE - Project Data Access Read/Write GROUP_DATA_ACCESS_READ_ONLY - Project Data Access Read Only https://docs.atlas.mongodb.com/reference/api/user-create/
Add support to the existing Plan
type to support adding/removing users from Atlas projects along with the "service plan instance" life cycle.
We would add a new field to each plan called atlasUser
. This allows consumers to pass along their information during cf create-service
for the corresponding Atlas API calls to add the user to the project.
Additional users can be added or removed from the Atlas project through an extension of the update-service
operation. For example, first Developer1 would run this command to just create a plan (Project, Cluster, DBUser, IPWhitelist):
cf create-service atlas basic-plan myatlasdb -c '{ "email" : "dev1@acme.com", ...}'
This would create the entire plan and add the user to the Atlas project. Now, when junior Developer2 needs access, how can they accomplish that themselves?
We will add a feature to update-service
to support this. So Developer1 just runs,
cf update-service myatlasdb dev2 -c '{ "op" : "AddUserToProject", "email" : "dev2@acme.com", "password" : "ChangeMe!", ...}'
In this case, Developer1 would set the password, instructing Dev2 to change it right away when the login. Note - the admin should document and understand this procedure for security implication, as the broker cannot control these passwords.
Removing users is similar,
cf update-service myatlasdb dev2 -c '{ "op" : "RemoveUserFromProject", "email" : "dev2@acme.com", ...}'
Users do not need to be "AddUserToProject" added to be "RemoveUserFromProject" removed. Meaning, you can remove users from Atlas project with this command even if they were added through the Atlas UI. This is a simple controller and will not maintain ANY state of the list of users in an Atlas project.
Note that this functionality would not control all the users in the Atlas project. Meaning, this functionality is is basic "controller" - it allows create & delete on specific Atlas users in specific projects. Should you need full management, please see the Atlas UI or use the API directly.
atlasUser
type from Atlas go library to Plan
, should be optional
Original request: 00685888: I want to invite a user via the API (MongoDB Internal)
Since the broker plans provision complete deployments, cluster admin need a was to add their users to be able to access these new Projects in Atlas. This ask is to consider how the broker could provide the functionality for cluster administrator to be able to offer a service which can add users to Atlas Projects.
I figured out a workflow and the corresponding APIs that will work. If we can add some command in the broker to update-service to add a user, here’s what the workflow would look like:
1) User calls broker command (maybe update service?). They input: firstName, lastName, emailAddress
2) The broker checks if the user already exists: GET https://cloud.mongodb.com/api/atlas/v1.0/users/byName/{{emailAddress}}
If user doesn’t exist, the response looks like below. 200 response. Have the broker store the user ID to be used afterwards.
3) if the user doesn’t exist, the response is a 401.
4) If user exists, use the API to add user to the project: PATCH https://cloud.mongodb.com/api/atlas/v1.0/users/{{userID}} Payload
5) If user doesn’t exist, use the API to create new user and add them to the project: POST https://cloud.mongodb.com/api/atlas/v1.0/users/
Payload
--- end of initial request ---
Proposed Solution
Add support to the existing
Plan
type to support adding/removing users from Atlas projects along with the "service plan instance" life cycle.We would add a new field to each plan called
atlasUser
. This allows consumers to pass along their information duringcf create-service
for the corresponding Atlas API calls to add the user to the project.Additional users can be added or removed from the Atlas project through an extension of the
update-service
operation. For example, first Developer1 would run this command to just create a plan (Project, Cluster, DBUser, IPWhitelist):This would create the entire plan and add the user to the Atlas project. Now, when junior Developer2 needs access, how can they accomplish that themselves?
We will add a feature to
update-service
to support this. So Developer1 just runs,In this case, Developer1 would set the password, instructing Dev2 to change it right away when the login. Note - the admin should document and understand this procedure for security implication, as the broker cannot control these passwords.
Removing users is similar,
Users do not need to be "AddUserToProject" added to be "RemoveUserFromProject" removed. Meaning, you can remove users from Atlas project with this command even if they were added through the Atlas UI. This is a simple controller and will not maintain ANY state of the list of users in an Atlas project.
Note that this functionality would not control all the users in the Atlas project. Meaning, this functionality is is basic "controller" - it allows create & delete on specific Atlas users in specific projects. Should you need full management, please see the Atlas UI or use the API directly.
Technical Notes
atlasUsers
toPlan