#42 Add tests for VoteVoter

This commit is contained in:
flecomte committed 2020-03-17 14:21:38 +01:00
1 parent 622deb0f7d
commit c0becd8fbd
2 files changed
+125 -14

No files matched your search

@@ -10,10 +10,7 @@ class VoteVoter : Voter {
}
override fun supports(action: ActionI, call: ApplicationCall, subject: Any?): Boolean {
return action is Action && (
subject is VoteEntity<*>? ||
subject is List<*>
)
return action is Action && subject is VoteEntity<*>?
}
override fun vote(action: ActionI, call: ApplicationCall, subject: Any?): Vote {
@@ -30,16 +27,6 @@ class VoteVoter : Voter {
Vote.GRANTED
}
}
if (subject is List<*>) {
subject.forEach {
if (it !is VoteEntity<*> || it.createdBy.user.id != user.id) {
return Vote.DENIED
}
}
return Vote.GRANTED
}
return Vote.DENIED
}