If I change my research group, can my former supervisor restrict my access to my codes that are written by myself?
Any supervisor (including the OP's former supervisor) is free to block access to their resources, even when those resources include code written by the person being block (including former students).