Can the Flag module be used to lock content while editing to prevent concurrent edits? We are trying to figure out a way to use the Flag module to prevent concurrent editing. In our research, we found the Content locking (anti-concurrent editing) module, but we thought since we are already using the flag module, that we could also use it for content locking.

The scenario would be if a user (person a) is already editing content A, and then another user (person b) tries to edit content A, then person b should not be allowed to edit content A until person a is done editing the content. 

What is the best way to do this because we are having trouble trying to find the right combination to get this done? We were thinking once a content is being edited, a flag is set to lock the content and whenever another user tries to edit the content, they are prompted with a message "person a is already editing the content. please wait until they are done". 

Is this possible with the Flag module? Would I need to use the Rules modules as well?
You can do it by using the node_validate function.

Your relevant part code is that :

if (isset($node-&gt;nid) &amp;&amp; (node_last_changed($node-&gt;nid) &gt; $node-&gt;changed)) {
    form_set_error('changed', t('The content on this page has either been modified by another user, or you have already submitted modifications using this form. As a result, your changes cannot be saved.'));
  }