Antoine Lyset

How to know if we can share a note ?

9 posts in this topic

Hi,

I checked with listSharedNotebooks and the ShareNotebookPrivilegeLevel for each SharedNotebook. But the GROUP PrivilegeLevel (3) seems a bit confusing. Where can I have the PrivilegeLevel of this GROUP ?

Do I really need to do all this API calls just to know if I have the User have the PrivilegeLevel to call the shareNote method ?

Share this post


Link to post

All the notes in the user's account are editable by the owner. It gets more tricky with notebooks that are shared by other users (learn more about sharing here). The list of all other users' notebooks are defined by linked notebooks. A reference of that sharing is stored in the owner's account as a SharedNotebook that contains the permissions given to other users. Here is a portion of code to help you understand how to get the sharednotebook and access the permissions:


$linkedNotebook = current($linkedNotebooks);
$parts = parse_url($linkedNotebook->noteStoreUrl);
if (!isset($parts['port'])) {
if ($parts['scheme'] === 'https') {
$parts['port'] = 443;
} else {
$parts['port'] = 80;
}
}
$sharedNoteStoreHttpClient =
new THttpClient($parts['host'], $parts['port'], $parts['path'], $parts['scheme']);
$sharedNoteStoreProtocol = new TBinaryProtocol($sharedNoteStoreHttpClient);
$sharedNoteStore = new NoteStoreClient($sharedNoteStoreProtocol, $sharedNoteStoreProtocol);
$sharedAuthResult =
$sharedNoteStore->authenticateToSharedNotebook($linkedNotebook->shareKey, $authToken);
$sharedAuthToken = $sharedAuthResult->authenticationToken;
$sharedNotebook = $sharedNoteStore->getSharedNotebookByAuth($sharedAuthToken);
// permissions are stored in $sharedNotebook-> notebookModifiable

Share this post


Link to post

Ok, NotebookModifiable is flagged as deprecated. But we can still use it ? It's fully compatible with Evernote Business Notebooks ?

Share this post


Link to post

Ok but if the user belongs to the PrivilegeLevel 3 (GROUP Privilege), how can we see the Privilege of this particular Group ?

Share this post


Link to post

The PrivilegeLevel GROUP is only used in a business context when sharing with the entire company. It is designed to propagate sharing configuration changes for notebooks that are in the Business library. The associated privilege level for those notebook are inherited from the Notebook.businessNotebook field.

Here is an example: if I share a notebook in read only mode with all the users in my business (sharedNotebook.SharedNotebookPrivilegeLevel = 3 and Notebook.businessNotebook = 1) and later decide to make it editable (sharedNotebook.SharedNotebookPrivilegeLevel = 3 and Notebook.businessNotebook = 5) all the users that have the previous permissions get full access as well.

Share this post


Link to post