Suppose that your chaincode function only allows identities from ManagerOrg, then you will check if the getMSPID() equals "ManagerOrg". You also could use ctx.clientIdentity.getID() if you want to control the access by ID, but it will be more tricky to handle.
This is the file I mentioned before. https://github.com/hyperledger/fabric-samples/blob/main/commercial-paper/organization/magnetocorp/contract/lib/papercontract.js#L184