diff options
author | desperateCoder <echotodevnull@gmail.com> | 2020-08-06 12:58:18 +0300 |
---|---|---|
committer | Niedermann IT-Dienstleistungen <stefan-niedermann@users.noreply.github.com> | 2020-08-09 17:34:18 +0300 |
commit | 0e91a9ad984aef575f2ad1ed9f013b8bac141697 (patch) | |
tree | fe088cb65e5824305c38a12769f7746e9a3170f2 /app/src | |
parent | 04313044eeeac744dac850c5ef953d3e1082cb85 (diff) |
#492 #631 add new filter rules to the rest of the user searches
Diffstat (limited to 'app/src')
2 files changed, 24 insertions, 20 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/DataBaseAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/DataBaseAdapter.java index 964626e91..d51374659 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/DataBaseAdapter.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/DataBaseAdapter.java @@ -659,10 +659,10 @@ public class DataBaseAdapter { return db.getUserDao().searchUserByUidOrDisplayName(accountId, boardId, notYetAssignedToLocalCardId, "%" + searchTerm.trim() + "%"); } - public LiveData<List<User>> searchUserByUidOrDisplayNameForACL(final long accountId, final long notYetAssignedToACL, final String searchTerm) { - validateSearchTerm(searchTerm); - return db.getUserDao().searchUserByUidOrDisplayNameForACL(accountId, notYetAssignedToACL, "%" + searchTerm.trim() + "%"); - } +// public LiveData<List<User>> searchUserByUidOrDisplayNameForACL(final long accountId, final long notYetAssignedToACL, final String searchTerm) { +// validateSearchTerm(searchTerm); +// return db.getUserDao().searchUserByUidOrDisplayNameForACL(accountId, notYetAssignedToACL, "%" + searchTerm.trim() + "%"); +// } public List<User> searchUserByUidOrDisplayNameForACLDirectly(final long accountId, final long notYetAssignedToACL, final String searchTerm) { validateSearchTerm(searchTerm); diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/UserDao.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/UserDao.java index 76dad1b15..e5e506728 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/UserDao.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/UserDao.java @@ -26,12 +26,16 @@ public interface UserDao extends GenericDao<User> { " where ju.userId = u.localId" + " and ju.cardId = :notYetAssignedToLocalCardId AND status <> 3" + // not LOCAL_DELETED " )" + - " AND" + - " (" + - " EXISTS (" + - " select 1 from accesscontrol" + - " where userId = u.localId and boardId = :boardId" + - " )" + + " AND ( " + + " EXISTS (" + + " select 1 from userinboard where boardId = :boardId AND userId = u.localId" + + " )" + + " OR" + + " EXISTS (" + + " select 1 from accesscontrol" + // v GROUP! + " where (userId = u.localId OR (type = 1 and exists(select 1 from UserInGroup uig where uig.memberId = u.localId and uig.groupId = userId))) " + + " and boardId = :boardId and status <> 3" + + " )" + " OR" + " EXISTS (" + " select 1 from board where localId = :boardId AND ownerId = u.localId" + @@ -40,15 +44,15 @@ public interface UserDao extends GenericDao<User> { "and ( uid LIKE :searchTerm or displayname LIKE :searchTerm or primaryKey LIKE :searchTerm )") LiveData<List<User>> searchUserByUidOrDisplayName(final long accountId, final long boardId, final long notYetAssignedToLocalCardId, final String searchTerm); - @Query("SELECT u.* FROM user u WHERE accountId = :accountId " + - " AND NOT EXISTS (" + - " select 1 from accesscontrol ju" + - " where ju.userId = u.localId and ju.boardId = :boardId and status <> 3" + // not LOCAL_DELETED - " ) " + - "and ( uid LIKE :searchTerm or displayname LIKE :searchTerm or primaryKey LIKE :searchTerm ) " + - "and u.localId <> (select b.ownerId from board b where localId = :boardId)" + - "ORDER BY u.displayname") - LiveData<List<User>> searchUserByUidOrDisplayNameForACL(final long accountId, final long boardId, final String searchTerm); +// @Query("SELECT u.* FROM user u WHERE accountId = :accountId " + +// " AND NOT EXISTS (" + +// " select 1 from accesscontrol ju" + +// " where ju.userId = u.localId and ju.boardId = :boardId and status <> 3" + // not LOCAL_DELETED +// " ) " + +// "and ( uid LIKE :searchTerm or displayname LIKE :searchTerm or primaryKey LIKE :searchTerm ) " + +// "and u.localId <> (select b.ownerId from board b where localId = :boardId)" + +// "ORDER BY u.displayname") +// LiveData<List<User>> searchUserByUidOrDisplayNameForACL(final long accountId, final long boardId, final String searchTerm); @Query("SELECT u.* FROM user u WHERE accountId = :accountId " + " AND NOT EXISTS (" + @@ -84,7 +88,7 @@ public interface UserDao extends GenericDao<User> { " EXISTS (" + " select 1 from accesscontrol" + // v GROUP! " where (userId = u.localId OR (type = 1 and exists(select 1 from UserInGroup uig where uig.memberId = u.localId and uig.groupId = userId))) " + - " and boardId = :boardId" + + " and boardId = :boardId and status <> 3" + " )" + " OR" + " EXISTS (" + |