You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2023/01/05 06:47:57 UTC

[GitHub] [james-project] vttranlina commented on a diff in pull request #1372: JAMES-3756 Delegation store should allow listing accounts delegated to me

vttranlina commented on code in PR #1372:
URL: https://github.com/apache/james-project/pull/1372#discussion_r1062154677


##########
server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersDAO.java:
##########
@@ -199,6 +255,27 @@ public Flux<Username> getAuthorizedUsers(Username name) {
             .map(Username::of);
     }
 
+    public Mono<Void> removeDelegatedToUser(Username baseUser, Username delegatedToUser) {
+        return executor.executeVoid(new BatchStatementBuilder(BatchType.LOGGED)
+            .addStatement(removeAuthorizedUsersStatement.bind()
+                .setString(NAME, delegatedToUser.asString())
+                .setSet(AUTHORIZED_USERS, ImmutableSet.of(baseUser.asString()), String.class))
+            .addStatement(removeDelegatedToUsersStatement.bind()
+                .setString(NAME, baseUser.asString())
+                .setSet(DELEGATED_USERS, ImmutableSet.of(delegatedToUser.asString()), String.class))
+            .build());
+    }
+
+    public Flux<Username> getDelegatedToUsers(Username name) {
+        return executor.executeSingleRow(
+                getDelegatedToUsersStatement.bind()
+                    .setString(NAME, name.asString()))
+            .mapNotNull(row -> row.getSet(DELEGATED_USERS, String.class))
+            .flatMapIterable(set -> set)
+            .map(Username::of);
+    }
+
+    // TODO, should we remove delegated user here?

Review Comment:
   Should we remove delegated users here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org