Add the TOS API.

This commit is contained in:
Anatoly Sablin
2019-10-09 23:12:23 +03:00
parent baed894ff8
commit add6ed8fd9
6 changed files with 132 additions and 12 deletions

View File

@@ -63,5 +63,7 @@ public interface IStorage {
void acceptTerm(String token, String url);
void deleteAccepts(String token);
boolean isTermAccepted(String token, List<PolicyConfig.PolicyObject> policies);
}

View File

@@ -294,6 +294,14 @@ public class OrmLiteSqlStorage implements IStorage {
});
}
@Override
public void deleteAccepts(String token) {
withCatcher(() -> {
AccountDao account = findAccount(token).orElseThrow(InvalidCredentialsException::new);
acceptedDao.delete(acceptedDao.queryForEq("userId", account.getUserId()));
});
}
@Override
public boolean isTermAccepted(String token, List<PolicyConfig.PolicyObject> policies) {
return withCatcher(() -> {