A page in Sitecore consists of multiple renderings with multiple data sources. Content authors need to acquire lock on a page to edit the page. When content authors save the component and submits it to next stage in workflow, Sitecore makes a check whether the context user has enough rights and the lock on the item (data source or page) to push it to next workflow. This is needed to make sure that the content author doesn't push an item that is not locked by it to next workflow. This is done using the below condition -
if (item.Access.CanWrite() && (!item.Locking.IsLocked() || item.Locking.HasLock()))
This condition is useful when we are building a customization related to workflow processing or experience editor's inline editing functionality.