text: Q:
  
  Question related to sharing
  
  Below is our scenario
  We have a custom case object. where ownership is based on queues.
  Users are assigned to queues and any user part of a queue gets access to all the cases assigned to the particular queue.
  We have a scenario where particular user of the queue can go for a court trial for that case. In that case all other members except for the trial user needs access to the case.
  If we remove the user from the queue he will lose access to all other cases assigned to that queue.
  If we remove access to the queue for that case then all members of queue lose access to the case.
  The solution we came up was to find all users who have access to the case, remove queue based access and then insert user share records for all users except for trial user using apex sharing.
  We have millions of cases and queues can have up to 1000 users. 
  Questions
  
  Is this solution scalable?
  Is there a better solution for this scenario?  
  Is there any way we can do it through configuration
  instead of code?
  
  A:
  
  You can hide the detail layout of the case from the target user going to the court trial. 
  
  Create a formula field, is courtgoing User Current user where formula is 
  $User.Id= Court_Going_User__c
  Use Component visibility of lightning on your detail page layout,
  
  and only display detail layout when is court going user current user is false.
  
  Also, you can also add a text area to tell the user that you cannot access the case data.
  
  You don't have to worry about sharing , Your org seems to be LDV org so sharing table would be extensive, and altering the sharing table having millions of records is slow.
  I agree List views would be pain, but if you show non sensetive information in them you can probably save yourself from sharing hell.
  
  