mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2026-03-10 18:55:03 +00:00
Update list sharing
Fix quite a variety of bugs with list sharing, mostly relating to ListShareGET not conforming to its contract
This commit is contained in:
@@ -12,7 +12,7 @@ public class ListGetter implements CallHandler{
|
||||
private final String cognitoID;
|
||||
|
||||
private final String GET_LIST = "SELECT * FROM List WHERE listID = ?;";
|
||||
private final String GET_LISTS = "SELECT listID FROM ListSharee WHERE userID = ? ORDER BY uiPosition;";
|
||||
private final String GET_LISTS = "SELECT listID, permissionLevel FROM ListSharee WHERE userID = ? ORDER BY uiPosition;";
|
||||
private final String SHARE_CHECK = "SELECT * FROM ListSharee WHERE listID = ?;";
|
||||
private final String GET_ENTRIES = "SELECT * FROM ListProduct WHERE listID = ?;";
|
||||
|
||||
@@ -32,7 +32,10 @@ public class ListGetter implements CallHandler{
|
||||
System.out.println(getListsResults);
|
||||
ArrayList<Integer> listIds = new ArrayList<>();
|
||||
while (getListsResults.next()) {
|
||||
listIds.add(getListsResults.getInt(1));
|
||||
Integer permissionLevel = getListsResults.getInt("permissionLevel");
|
||||
if (ListPermissions.hasPermission(permissionLevel, "Read")) {
|
||||
listIds.add(getListsResults.getInt("listID"));
|
||||
}
|
||||
}
|
||||
return listIds;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ListPermissions {
|
||||
}
|
||||
|
||||
public static boolean hasPermission(Integer level, String permission) {
|
||||
return level % getKeyForPermission(permission) == 0;
|
||||
return (level % getKeyForPermission(permission) == 0 && level != 0);
|
||||
}
|
||||
|
||||
public static Integer getKeyForPermission(String permissionRaw) {
|
||||
|
||||
Reference in New Issue
Block a user