You can get this to work with the Rules module. The rule you'd need is something like so:
{ "rules_disallow_edit_of_approved_nodes" : {
"LABEL" : "Disallow edit of approved nodes",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_update" : [] },
"IF" : [
{ "NOT user_has_role" : {
"account" : [ "site:current-user" ],
"roles" : { "value" : { "6" : "6" } }
}
},
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_approval_status" } },
{ "data_is" : { "data" : [ "node:field-approval-status" ], "value" : "approved" } }
],
"DO" : [
{ "drupal_message" : {
"message" : "Sorry, edit is not allowed (admin status is approved).",
"type" : "error"
}
},
{ "redirect" : { "url" : "no_access" } }
]
}
}
To experiment with this rule in your own site, just copy the entire Rules code above, and paste it in a new Rule in your own site, created via the "Import" function. Then further edit/refine to make it fit in your own environment, e.g:
- this rule assumes that the tester role has role id = 6 (change to whatever role id that fits).
- the machine name (
field_approval_status
) and the field value (approved
) of the field that contains the approval status.
- adapt the "Sorry, ..." message to be shown, if needed.
- the URL to redirect to.