LockPolicy.h header
#include <ew/app/LockPolicy.h>
Namespace ew::app
Functions
bool ew::app::policy::isWritable(const ew::core::content::ContentObject &object)
Whether object may be CHANGED as far as its lock is concerned – the one place the lock question is asked.
A lock refuses writes for every asker, including the person who set it: "mark it done and keep it safe" is protection from oneself, so exempting the local user would defeat it. That is why this takes no principal – ew::core::policy::authorize's lock rule does not depend on one, and inventing a parameter that cannot change the answer would invite call sites to pass whatever was nearest.
THIS ANSWERS THE LOCK QUESTION ONLY. An object can be unlocked and still not writable – notably one living in a read-only mounted library, which is ew::app::library::MountedLibraries::isWritable's business and a separate axis that composes with this one. A caller that must refuse both asks both. The name is deliberately not mayWrite, which would read as "writable at all" and quietly answer less than it promised.
Reading is never refused by a lock: a finished document is still shown, still searched, still exported, and can still be MOVED – arranging the book is not changing the work.