Restrict blocks to user group

Hi there I am wanting to create a group of users who have a restricted access to some set blocks. I need to do this with code as i want to apply this to many of my sites. … I.e I am creating a client view and trying to remove via code blocks that they don’t need access to - is there any way to do this?
Cheers

You already know how to do this through block permissions but you’re looking for a way to automate it across sites?

Yeah exactly… any ideas?

You can programmatically add/change permissions.

So if you want to apply the same changes to multiple sites, you could make a small package that applies those changes on install or upgrade.