How to make a topic visible to a group and the creator when the user is not a member of the group?

What I’m actually trying to accomplish is time based permissions per user or maybe groups.
A user would only be able to see/reply posts if they are older than X days or when the user created the topic.