Skip to content
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

Invitations service #5700

Merged
merged 14 commits into from
Mar 28, 2023
Merged

Invitations service #5700

merged 14 commits into from
Mar 28, 2023

Conversation

butonic
Copy link
Member

@butonic butonic commented Mar 1, 2023

This PR introduces an invitation service that will alloww adding guest accounts.

It is based on the MS Graph API for invitations and will use the second option:

When the user is invited, a user entity (of userType Guest) is created and can now be used to control access to resources. The invited user has to go through the redemption process to access any resources they have been invited to.

Todo

  • requires Add Invitations libre-graph-api#98
  • introduce User.Invite.All permission
  • check user has User.Invite.All or User.ReadWrite.All (or the current equivalent) permissions
  • make provisioning endpoint configurable (should work with user and educationUser)
  • forward current auth token or
  • use configured bearer token
  • tests
  • web ui ...

new service TODO from #5710

  • Provide a readme.md for that service
  • If a new CLI command(s) is introduced, that command must be described in the readme. autogenerated
  • Add the service to the makefile in the ocis repo root
  • Make the service startable for binary and individual startup
    • For single binary add service to ocis/pkg/runtime
    • For individual startup add service to ocis/pkg/commands
  • Add the service to .drone.star to enable ci
  • Make the service appear in owncloud.dev
    (needs a description what needs to be added so it appears automatically)
  • If there is no extra description, make the readme the description text for that service in owncloud.dev
  • Inform doc team in an early stage to review the readme AND the environment variables created.
    (the description must reflect the behaviour AND usually has a positive code quality impact)
  • Create proper description strings for envvars - see other services for examples, especially when it comes to multiple values
    (base description, set of available values, description of each value)
  • When suggestable commits are created for text changes and you agree, collect them to a batch and commit them. Do not forget to rebase locally to avoid overwriting the changes made.
  • If new envvars are introduced which serve the same purpose but in multiple services, an additional envvar must be added at the beginning of the list starting with OCIS_ (global envvar).
  • Ensure that a service has a debug port (see issue: Ensure all services have a debug port #5712)

@update-docs
Copy link

update-docs bot commented Mar 1, 2023

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@butonic butonic self-assigned this Mar 1, 2023
@mmattel
Copy link
Contributor

mmattel commented Mar 2, 2023

You need to add the invitations service to the list in the makefile in the repo root.
The cli command needs to be added to the readme.

@kobergj
Copy link
Collaborator

kobergj commented Mar 2, 2023

Since this is a new service this list might be helpful not to forget anything: #5710

@butonic
Copy link
Member Author

butonic commented Mar 2, 2023

@mmattel can you point to a service that adds the cli in the readme? And how do I make the docs use the README.md?

@mmattel
Copy link
Contributor

mmattel commented Mar 2, 2023

@mmattel can you point to a service that adds the cli in the readme? And how do I make the docs use the README.md?

Have a look at the referenced issue, I removed that item and added a better description in:
Make the service appear in owncloud.dev... covering that topic. You may just need to copy/paste it.

@butonic
Copy link
Member Author

butonic commented Mar 3, 2023

Invitations drawio

@mmattel
Copy link
Contributor

mmattel commented Mar 3, 2023

Q: will the invitations service introduce a new port for its work?

@butonic
Copy link
Member Author

butonic commented Mar 23, 2023

Q: will the invitations service introduce a new port for its work?

yes, but it will pick a random free port and register with the service registry: https://github.com/owncloud/ocis/pull/5700/files#diff-d771144a7c500156a0ed3657019b7def82df21e79ebc901756caa91dfc335237R25

If you want to set a specific port it can be done https://github.com/owncloud/ocis/pull/5700/files#diff-41fd01f62653382faadeeca0ab7a3547acd1ac91a023700c541acb41c66119cbR15

butonic and others added 11 commits March 24, 2023 11:42
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
As keycloak already supports everything needed for the required
invitation flow, it's ideal to use as the first backend to create users
and to send them invitation mails.

This PR implements that as the first and (for now) only backend.
@ainmosni ainmosni marked this pull request as ready for review March 24, 2023 10:47
}

// Backend defines the behaviour of a user backend.
type Backend interface {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when adding graph we can move this to the common package

Copy link
Member Author

@butonic butonic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libregraph invitation service structs should be actually moved to libregraph in a subsequent pr

@sonarcloud
Copy link

sonarcloud bot commented Mar 24, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 7 Code Smells

16.6% 16.6% Coverage
1.6% 1.6% Duplication

@kobergj kobergj merged commit bfe8ed8 into master Mar 28, 2023
@delete-merged-branch delete-merged-branch bot deleted the invitations branch March 28, 2023 13:28
ownclouders pushed a commit that referenced this pull request Mar 28, 2023
ownclouders pushed a commit that referenced this pull request Mar 29, 2023
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.

5 participants