diff options
author | desperateCoder <echotodevnull@gmail.com> | 2019-10-19 22:28:24 +0300 |
---|---|---|
committer | desperateCoder <echotodevnull@gmail.com> | 2019-10-19 22:28:29 +0300 |
commit | cc89e57d7860af61af33886f8c7005cec517a0fb (patch) | |
tree | 97f5c78622d4fcc04998a05fd83c10463e043dbb | |
parent | 00b4ac3996b5032895cff2021cd2958a1d303871 (diff) |
#193 provide ACL for a specific Board
3 files changed, 13 insertions, 0 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManager.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManager.java index 246b019cc..8947a0ed2 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManager.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/SyncManager.java @@ -264,6 +264,10 @@ public class SyncManager { return dataBaseAdapter.getAccessControlByRemoteIdDirectly(accountId, id); } + public LiveData<List<AccessControl>> getAccessControlByLocalBoardId(long accountId, Long id) { + return dataBaseAdapter.getAccessControlByLocalBoardId(accountId, id); + } + public void updateAccessControl(AccessControl entity) { doAsync(() -> { dataBaseAdapter.updateAccessControl(entity, true); 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 d3cc22c10..128c8728c 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 @@ -363,6 +363,10 @@ public class DataBaseAdapter { return db.getAccessControlDao().getAccessControlByRemoteIdDirectly(accountId, id); } + public LiveData<List<AccessControl>> getAccessControlByLocalBoardId(long accountId, Long id) { + return db.getAccessControlDao().getAccessControlByLocalBoardId(accountId, id); + } + public void updateAccessControl(AccessControl entity, boolean setStatus) { markAsEditedIfNeeded(entity, setStatus); db.getAccessControlDao().update(entity); diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/AccessControlDao.java b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/AccessControlDao.java index faa65c8f1..4a42cf88b 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/AccessControlDao.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/persistence/sync/adapters/db/dao/AccessControlDao.java @@ -4,6 +4,8 @@ import androidx.lifecycle.LiveData; import androidx.room.Dao; import androidx.room.Query; +import java.util.List; + import it.niedermann.nextcloud.deck.model.AccessControl; @Dao @@ -12,6 +14,9 @@ public interface AccessControlDao extends GenericDao<AccessControl> { @Query("SELECT * FROM AccessControl WHERE accountId = :accountId and id = :remoteId") LiveData<AccessControl> getAccessControlByRemoteId(final long accountId, final long remoteId); + @Query("SELECT * FROM AccessControl WHERE accountId = :accountId and boardId = :localBoardId") + LiveData<List<AccessControl>> getAccessControlByLocalBoardId(final long accountId, final long localBoardId); + @Query("SELECT * FROM AccessControl WHERE accountId = :accountId and id = :remoteId") AccessControl getAccessControlByRemoteIdDirectly(final long accountId, final long remoteId); }
\ No newline at end of file |