-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow setting users together with directories, improve users endpoint
Users (and groups) directly belong to a directory. Because of that, the cleanest way to declaratively add or update directory users (and groups) would be to set them as a child element of a directory. E.g.: ``` directories: internal: name: Internal Directory ... users: user1: password: ... user2: password: ... ``` With this change it is possible to set users together with directories, however still as lists (not as maps as in the example), and for groups this still needs to be implemented if needed. Also improve the users endpoint itself and allow passing a directory ID when performing user actions. The old behaviour that didn't require a directory ID is inacurate because would just any random directory that contains a user with the given name, and thus the related methods have been deprecated.
- Loading branch information
Showing
10 changed files
with
782 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/de/aservo/confapi/crowd/exception/NotFoundExceptionForDirectory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package de.aservo.confapi.crowd.exception; | ||
|
||
import de.aservo.confapi.commons.exception.NotFoundException; | ||
import de.aservo.confapi.commons.model.AbstractDirectoryBean; | ||
|
||
@SuppressWarnings("java:S110") | ||
public class NotFoundExceptionForDirectory extends NotFoundException { | ||
|
||
public NotFoundExceptionForDirectory( | ||
final AbstractDirectoryBean directoryBean) { | ||
|
||
this(directoryBean.getName()); | ||
} | ||
|
||
public NotFoundExceptionForDirectory( | ||
final String name) { | ||
|
||
super(String.format("Directory with name '%s' could not be found", name)); | ||
} | ||
|
||
public NotFoundExceptionForDirectory( | ||
final long id) { | ||
|
||
super(String.format("Directory with id '%s' could not be found", id)); | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/de/aservo/confapi/crowd/exception/NotFoundExceptionForUser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package de.aservo.confapi.crowd.exception; | ||
|
||
import de.aservo.confapi.commons.exception.NotFoundException; | ||
import de.aservo.confapi.commons.model.UserBean; | ||
|
||
@SuppressWarnings("java:S110") | ||
public class NotFoundExceptionForUser extends NotFoundException { | ||
|
||
public NotFoundExceptionForUser( | ||
final UserBean userBean) { | ||
|
||
this(userBean.getUsername()); | ||
} | ||
|
||
public NotFoundExceptionForUser( | ||
final String name) { | ||
|
||
super(String.format("User with name '%s' could not be found", name)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.