feat: support UserValidation lookups by mail by ebarault · Pull Request #126 · upbound/function-msgraph · GitHub
Skip to content

feat: support UserValidation lookups by mail - #126

Open
ebarault wants to merge 6 commits into
upbound:mainfrom
ebarault:feat/user-lookup-mail
Open

ebarault wants to merge 6 commits into
upbound:mainfrom
ebarault:feat/user-lookup-mail

Conversation

@ebarault

Copy link
Copy Markdown

Description of your changes

UserValidation currently always looks up userPrincipalName. For B2B guests, the tenant-specific UPN often differs from their mail address, so callers must expose or reconstruct a guest UPN to resolve a user.

This adds an optional userLookupField (userPrincipalName or mail). Omitting it keeps the existing UPN lookup. It works with both users and usersRef and leaves the returned user fields unchanged.

queryType: UserValidation
userLookupField: mail
usersRef: spec.owners
target: status.validatedUsers

Mail lookups fail on multiple matches or a paginated response rather than returning several principals for one requested owner. No-match behavior is unchanged (empty results). Filter values escape OData apostrophes, and unsupported lookup properties are rejected. No additional Graph permissions are required beyond the existing User.Read.All used for user validation.

Includes generated input schema, README documentation, and SDK request/response tests against a local HTTP server: default/explicit UPN, mail lookup of a guest with a different UPN, apostrophe escaping, no matches, ambiguous/paginated results and invalid field rejection. No live Entra calls or deployment are part of these tests.

Validation

  • go generate ./input/...
  • go mod tidy
  • go test ./...
  • go test -race ./...
  • go vet ./...
  • golangci-lint run (v2.12.2, matching upstream CI)

I have:

Signed-off-by: Eric Barault <eric.barault@gmail.com>
Signed-off-by: Eric Barault <eric.barault@gmail.com>
…n.crossplane.io_inputs.yaml)

Signed-off-by: Eric Barault <eric.barault@gmail.com>
Signed-off-by: Eric Barault <eric.barault@gmail.com>
Signed-off-by: Eric Barault <eric.barault@gmail.com>
Signed-off-by: Eric Barault <eric.barault@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant