By adding the USER_INFO scope to your editor extension definition in manifest.json, you can utilize the UserProxy class to access user information:

import {EditorClient, UserProxy} from 'lucid-extension-sdk';

const client = new EditorClient();
const user = new UserProxy(client);
console.log(user.id);

Get user's permission on the document

Knowing the user's permissions on a document can be helpful to determine what actions can be performed by the extension. For example, if the user only has view permissions on a document then the extension will be unable to perform any actions that write content to the document:

import {DocumentProxy, EditorClient, Menu, MenuType, UserProxy} from 'lucid-extension-sdk';
import {DocumentAccessPermission} from 'lucid-extension-sdk/document/documentaccesspermission';

const client = new EditorClient();
const menu = new Menu(client);
const user = new UserProxy(client);

const document = new DocumentProxy(client);
const documentPermission = user.getAccessPermssionOnDocument();

client.registerAction('createBlock', async () => {
    const page = document.pages.first();
    if (page) {
        if (hasWriteAccess()) {
            await client.loadBlockClasses(['ProcessBlock']);
            page.addBlock({
                className: 'ProcessBlock',
                boundingBox: {
                    x: 100,
                    y: 100,
                    w: 200,
                    h: 160,
                },
            });
        } else {
            console.log("The user doesn't have write access to the document!");
        }
    }
});

function hasWriteAccess() {
    return documentPermission === DocumentAccessPermission.Edit || documentPermission === DocumentAccessPermission.EditAndShare;
}

menu.addDropdownMenuItem({
    label: 'Create Block',
    action: 'createBlock',
});