-
Notifications
You must be signed in to change notification settings - Fork 300
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
refactor(invitations): enable azure_invitation for non Admins #1075
refactor(invitations): enable azure_invitation for non Admins #1075
Conversation
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.
Thanks for proposing this @bufferoverflow. Unfortunately I don't think we can simply skip over 403 errors as this would mask permissions errors and we have no way of knowing whether this is desirable or not for the user.
A agree, however the question is why is it necessary to modify the user after creating the invitation. According to https://learn.microsoft.com/en-us/graph/api/invitation-post?view=graph-rest-1.0&tabs=http#response checking for a Regarding Destroying the resource, there is no information within the docs that a user will be deleted. I think destroying a invitation should not delete the user. |
Ah right, I see what you mean, on closer look this is entirely a consistency check. Whilst there's no functional reason for patching the new guest user, we do it because it can take some number of minutes for the user to be created from the invitation, and we need to know the user object was created before the resource returns - otherwise if the user is referenced or managed later in the same configuration, it will fail with a 404 error. That is also a good point regarding user deletion from this resource. The plan is actually to merge this with the azuread_user resource, or at least roll this functionality into the azuread_user resource - that way we can try to better assert for consistency. Once this has been rolled into the azuread_user resource, we can simplify the azuread_invitation resource to remove the consistency check and the user deletion. In the meantime, I'm not sure that I'm comfortable ignoring this check as this would potentially break a bunch of practitioners - we might need to look at doing this in the next major version. We should probably update the docs to clarify that |
Do you have somehow a timeline regarding this plan? I'm asking because I might to use the fork for a while if this does not happen within a reasonable time frame.
I would prefer and recommend removing the User deletion already from the invite as it is misleading and not obvious that a User gets deleted using the invite. I will investigate a bit on other options to check if a user is there instead of modifying it. |
@manicminer What about using |
@bufferoverflow Unfortunately, the reason why a PATCH request is being sent is that GET requests for new resources tend to be cached on creation by the API so they are returned before they are replicated. |
Requiring User.ReadWrite.All permissions for inviting users is just not gonna work, it's way to many permissions. If the patch cannot be replaced by a GET or by looking for the 201 response on the invite, I would suggest just making this optional. It might not be ideal, but for me I would a lot better than now, where inviting users are not even possible without god permissions. |
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.
@manicminer I added some documentation and suggested two changes to the PR. Would appreciate your feedback on this.
… a high privileged user or service principal
… check of existense by modifing the user
38ea38d
to
fcfca7d
Compare
fcfca7d
to
09c53b8
Compare
@bufferoverflow I appreciate the updates, and whilst I would definitely like to make the Before doing this, we'll need to add the current functionality into the Accordingly, I'll have to mark this PR for |
thanks for the update @manicminer ! right now we are using the code from this MR with a delay tweak:
|
@bufferoverflow In the interest of helping with project maintenance, and avoiding stale PRs and merge conflicts down the line, I'm going to go ahead and close this PR for the time being. I've added it to the v3.0 milestone, so that we can go through and revisit former/closed PRs when we get closer to the time. Appreciate this suggestion, we'll circle back as we get closer to v3.0. |
Closes #885