-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Users in a system to include editing system admin flag and remove from system * Global user viewing to include adding users, editing users, removing users, and adding users to a system. * New tests
- Loading branch information
Showing
14 changed files
with
988 additions
and
22 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
34 changes: 34 additions & 0 deletions
34
service/src/main/java/org/kiwiproject/champagne/dao/mappers/UserInSystemMapper.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,34 @@ | ||
package org.kiwiproject.champagne.dao.mappers; | ||
|
||
import static org.kiwiproject.jdbc.KiwiJdbc.instantFromTimestamp; | ||
|
||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
|
||
import org.jdbi.v3.core.mapper.RowMapper; | ||
import org.jdbi.v3.core.statement.StatementContext; | ||
import org.kiwiproject.champagne.model.User; | ||
import org.kiwiproject.champagne.model.UserInSystem; | ||
|
||
public class UserInSystemMapper implements RowMapper<UserInSystem> { | ||
|
||
@Override | ||
public UserInSystem map(ResultSet r, StatementContext ctx) throws SQLException { | ||
|
||
var user = User.builder() | ||
.id(r.getLong("id")) | ||
.createdAt(instantFromTimestamp(r, "created_at")) | ||
.updatedAt(instantFromTimestamp(r, "updated_at")) | ||
.firstName(r.getString("first_name")) | ||
.lastName(r.getString("last_name")) | ||
.displayName(r.getString("display_name")) | ||
.systemIdentifier(r.getString("system_identifier")) | ||
.admin(r.getBoolean("admin")) | ||
.build(); | ||
|
||
return UserInSystem.builder() | ||
.user(user) | ||
.systemAdmin(r.getBoolean("system_admin")) | ||
.build(); | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
service/src/main/java/org/kiwiproject/champagne/model/UserInSystem.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,18 @@ | ||
package org.kiwiproject.champagne.model; | ||
|
||
import lombok.Builder; | ||
import lombok.Value; | ||
import lombok.experimental.Delegate; | ||
|
||
/** | ||
* Core model for user information in relation to a specific deployable system. This model delegates a true User object. | ||
*/ | ||
@Value | ||
@Builder | ||
public class UserInSystem { | ||
|
||
@Delegate | ||
User user; | ||
|
||
boolean systemAdmin; | ||
} |
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.