Like mentioned above, you should remove the logic from the Business Rules, as they will unlock the fields.
What you can do is have your form load in JavaScript check the security role of the logged in user. If the user falls under the read-write security role, enable the fields that you want enabled.
You can use Xrm.Page.context.getUserRoles, and use webapi (or rest calls) to check if the user exist in those roles. Based on that, make the above required changes.
Below are the function that you can achieve this with:
function onLoad() {
var formType = Xrm.Page.ui.getFormType();
var roleName = 'ReadWriteRoleName';
var options = "$select=*&$filter=Name eq '" + roleName + "'";
SDK.REST.retrieveMultipleRecords("Role", options, retrieveRolesCallback, function (error) { alert(error.message); }, retrieveRolesComplete);
}
function retrieveRolesCallback(retrievedRoles)
{
var isUserInRole = false;
for (var i = 0; i < retrievedRoles.length; i++) {
var row = {};
var role = retrievedRoles[i];
var roleId = role["RoleId"];
var userInRole = checkUserInRole(roleId)
if (userInRole)
{
isUserInRole = true;
break;
}
}
if (isUserInRole)
enableFields();
}
function retrieveRolesComplete()
{
}
function checkUserInRole(roleId)
{
var isUserInRole = false;
var userRoles = Xrm.Page.context.getUserRoles();
for (var i = 0; i < userRoles.length; i++)
{
if (userRoles[i] == roleId)
{
isUserInRole = true;
break;
}
}
return isUserInRole;
}