Limiting access to users not assigned the task

Limiting access to users not assigned the task

Is their a way to limit access to a user if they are not assigned a task.  If a user is assigned a task they should not be able to see documents and information related to other task.