-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: adds endpoints to manually create users and groups from the provider #863
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,18 +18,35 @@ | |
|
||
import de.terrestris.shogun.lib.model.User; | ||
import de.terrestris.shogun.lib.service.UserService; | ||
import de.terrestris.shogun.lib.service.security.provider.UserProviderService; | ||
import io.swagger.v3.oas.annotations.security.SecurityRequirement; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.extern.log4j.Log4j2; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/users") | ||
@ConditionalOnExpression("${controller.users.enabled:true}") | ||
@Log4j2 | ||
@Tag( | ||
name = "Users", | ||
description = "The endpoints to manage users" | ||
) | ||
@SecurityRequirement(name = "bearer-key") | ||
public class UserController extends BaseController<UserService, User> { } | ||
public class UserController extends BaseController<UserService, User> { | ||
|
||
@Autowired | ||
private UserProviderService userProviderService; | ||
|
||
@PostMapping("/createFromProvider") | ||
@ResponseStatus(HttpStatus.OK) | ||
public void createFromProvider() { | ||
userProviderService.createAllUsers(); | ||
} | ||
Comment on lines
+47
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above. |
||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,5 @@ public interface GroupProviderService<UserType, GroupType> { | |
|
||
Group<GroupType> findOrCreateByProviderId(String providerGroupId); | ||
|
||
void createAllGroups(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wondering, do we need to flag this commit as breaking? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not breaking anything, is it? It's a new feature. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it's changing an interface, project implementations would need to include the implementation of the newly added method. |
||
} |
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.
Can we add some notes for the OpenAPI spec? The controllers in the BaseController might be a good inspiration.
And can we also add some error handling?