james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [5/7] james-project git commit: JAMES-1956 Avoid unnecessary INDEX creation on users' real name
Date Tue, 14 Mar 2017 09:01:45 GMT
JAMES-1956 Avoid unnecessary INDEX creation on users' real name


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/bdf1f079
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/bdf1f079
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/bdf1f079

Branch: refs/heads/master
Commit: bdf1f079109b8e7ddab69a1b1afb2d9fddff9b92
Parents: f7e6514
Author: benwa <btellier@linagora.com>
Authored: Tue Mar 7 09:52:45 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Tue Mar 14 15:59:55 2017 +0700

----------------------------------------------------------------------
 .../james/user/cassandra/CassandraUsersRepository.java       | 3 ++-
 .../james/user/cassandra/CassandraUsersRepositoryModule.java | 8 +-------
 2 files changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/bdf1f079/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepository.java
----------------------------------------------------------------------
diff --git a/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepository.java
b/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepository.java
index f8d2770..e87a1ba 100644
--- a/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepository.java
+++ b/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepository.java
@@ -67,9 +67,10 @@ public class CassandraUsersRepository extends AbstractUsersRepository {
         ResultSet result = session.execute(
                 select(REALNAME, PASSWORD, ALGORITHM)
                 .from(TABLE_NAME)
-                .where(eq(REALNAME, name)));
+                .where(eq(NAME, name.toLowerCase())));
         return Optional.ofNullable(result.one())
             .map(row -> new DefaultUser(row.getString(REALNAME), row.getString(PASSWORD),
row.getString(ALGORITHM)))
+            .filter(user -> user.getUserName().equals(name))
             .orElse(null);
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/bdf1f079/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepositoryModule.java
----------------------------------------------------------------------
diff --git a/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepositoryModule.java
b/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepositoryModule.java
index 06faf1a..a66d2bd 100644
--- a/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepositoryModule.java
+++ b/server/data/data-cassandra/src/main/java/org/apache/james/user/cassandra/CassandraUsersRepositoryModule.java
@@ -48,13 +48,7 @@ public class CassandraUsersRepositoryModule implements CassandraModule
{
                         .addColumn(CassandraUserTable.PASSWORD, text())
                         .addColumn(CassandraUserTable.ALGORITHM, text()))
                     );
-        index = ImmutableList.of(
-                new CassandraIndex(
-                    SchemaBuilder.createIndex(CassandraIndex.INDEX_PREFIX + CassandraUserTable.TABLE_NAME
+ CassandraUserTable.REALNAME)
-                        .ifNotExists()
-                        .onTable(CassandraUserTable.TABLE_NAME)
-                        .andColumn(CassandraUserTable.REALNAME))
-                );
+        index = ImmutableList.of();
         types = ImmutableList.of();
     }
 


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


Mime
View raw message