mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 02:38:47 +00:00
Merge branch 'sharing-permissions' into intra-list-ordering
This commit is contained in:
commit
ce8070cf43
@ -44,14 +44,17 @@ public class ListGetter implements CallHandler{
|
|||||||
boolean verifiedAccess = false;
|
boolean verifiedAccess = false;
|
||||||
int uiPosition = 1;
|
int uiPosition = 1;
|
||||||
while ((sharees < 2 && accessResults.next()) || !verifiedAccess) {
|
while ((sharees < 2 && accessResults.next()) || !verifiedAccess) {
|
||||||
|
int permissionLevel = accessResults.getInt("permissionLevel");
|
||||||
if (accessResults.getString("userID").equals(cognitoID)) {
|
if (accessResults.getString("userID").equals(cognitoID)) {
|
||||||
verifiedAccess = true;
|
verifiedAccess = true;
|
||||||
if (!ListPermissions.hasPermission(accessResults.getInt("permissionLevel"), "Read")) {
|
if (!ListPermissions.hasPermission(permissionLevel, "Read")) {
|
||||||
throw new AccessControlException("User " + cognitoID + " does not have permission to read list " + id);
|
throw new AccessControlException("User " + cognitoID + " does not have permission to read list " + id);
|
||||||
}
|
}
|
||||||
uiPosition = accessResults.getInt("uiPosition");
|
uiPosition = accessResults.getInt("uiPosition");
|
||||||
}
|
}
|
||||||
sharees++;
|
if (permissionLevel > 0) {
|
||||||
|
sharees++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
boolean shared = false;
|
boolean shared = false;
|
||||||
if (sharees > 1) {
|
if (sharees > 1) {
|
||||||
|
|||||||
@ -22,8 +22,8 @@ public class ListSharer implements CallHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final private String CHECK_ACCESS = "SELECT * from ListSharee WHERE listID = ? AND userID = ?;";
|
final private String CHECK_ACCESS = "SELECT * from ListSharee WHERE listID = ? AND userID = ?;";
|
||||||
final private String SHARE_LIST = "INSERT INTO ListSharee(listID, userID, permissionLevel, ) VALUES(?, ?, ?, ?) ON DUPLICATE KEY UPDATE permissionLevel = ?;";
|
|
||||||
private final String UI_POSITION_CHECK = "SELECT Max(uiPosition) as maxUIPosition FROM ListSharee WHERE userID = ?;";
|
private final String UI_POSITION_CHECK = "SELECT Max(uiPosition) as maxUIPosition FROM ListSharee WHERE userID = ?;";
|
||||||
|
final private String SHARE_LIST = "INSERT INTO ListSharee(listID, userID, permissionLevel, uiPosition) VALUES(?, ?, ?, ?) ON DUPLICATE KEY UPDATE permissionLevel = ?;";
|
||||||
|
|
||||||
public Object conductAction(Map<String, Object> bodyMap, HashMap<String, String> queryString, String cognitoID) throws SQLException {
|
public Object conductAction(Map<String, Object> bodyMap, HashMap<String, String> queryString, String cognitoID) throws SQLException {
|
||||||
PreparedStatement checkAccess = connection.prepareStatement(CHECK_ACCESS);
|
PreparedStatement checkAccess = connection.prepareStatement(CHECK_ACCESS);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user