@Test public void testHasWriteAccessWithWriteAccess() { ParseUser user = mock(ParseUser.class); ParseACL acl = mock(ParseACL.class); when(acl.getWriteAccess(user)).thenReturn(true); ParseObject object = mock(ParseObject.class); when(object.getACL()).thenReturn(acl); assertTrue(OfflineQueryLogic.hasWriteAccess(user, object)); }
static <T extends ParseObject> boolean hasWriteAccess(ParseUser user, T object) { if (user == object) { return true; } ParseACL acl = object.getACL(); if (acl == null) { return true; } if (acl.getPublicWriteAccess()) { return true; } return user != null && acl.getWriteAccess(user); }
OfflineQueryLogic { static <T extends ParseObject> boolean hasWriteAccess(ParseUser user, T object) { if (user == object) { return true; } ParseACL acl = object.getACL(); if (acl == null) { return true; } if (acl.getPublicWriteAccess()) { return true; } return user != null && acl.getWriteAccess(user); } }
OfflineQueryLogic { static <T extends ParseObject> boolean hasWriteAccess(ParseUser user, T object) { if (user == object) { return true; } ParseACL acl = object.getACL(); if (acl == null) { return true; } if (acl.getPublicWriteAccess()) { return true; } return user != null && acl.getWriteAccess(user); } OfflineQueryLogic(OfflineStore store); }
OfflineQueryLogic { static <T extends ParseObject> boolean hasWriteAccess(ParseUser user, T object) { if (user == object) { return true; } ParseACL acl = object.getACL(); if (acl == null) { return true; } if (acl.getPublicWriteAccess()) { return true; } return user != null && acl.getWriteAccess(user); } OfflineQueryLogic(OfflineStore store);  }
OfflineQueryLogic { static <T extends ParseObject> boolean hasWriteAccess(ParseUser user, T object) { if (user == object) { return true; } ParseACL acl = object.getACL(); if (acl == null) { return true; } if (acl.getPublicWriteAccess()) { return true; } return user != null && acl.getWriteAccess(user); } OfflineQueryLogic(OfflineStore store);   }