Restrict IP based access.
Open the smb.conf file add the ip to directive hosts allow = <ip>
Restrict the users
Open the smb.conf file add the users to the directive valid users = user1 user2
Restricting Read and Write access to users.
Modify the following directive
read only = yes
write list = user1 user2
Example:
To restrict the access to Ip : 10.0.0.57 and restrict the write permission to user1
Open smb.conf file add the following lines
hosts allow = 10.0.0.57
valid users = user1, user2
read only = yes
write list = user1