Sharing and users

The method name is generateSharableUrlLinks. For a new link, provide item IDs, a password of at least eight characters, permissions, an identity type, and null for the existing URL token:

sdk.generateSharableUrlLinks([123], 'share-password', 4, 5, null, onSuccess, onError);

For an existing link, pass its URL token and an empty ID array. Supply a new password to change it, or '' to leave it unchanged:

sdk.generateSharableUrlLinks([], '', 4, 5, 'existing-url-token', onSuccess, onError);
Permission Access
4 Download
5 View
6 Upload
7 View and edit
8 Download, view, and upload
9 Download, view, and edit
10 Upload and view
11 Upload, edit, and view
12 Upload, download, edit, and view

Identity type 5 identifies recipients by Geens ID; 6 uses their surname. The success callback receives the API's link response.

sdk.getSharedUrl(123, {
  url_token: 'existing-url-token',
  password: 'share-password'
}, onSuccess, onError);

sdk.revokeUrlShare('existing-url-token', onSuccess, onError);

getSharedUrl accepts a folder/item ID and returns decrypted items. Its optional external_access_token field is an array of strings.

Look up users

Geens IDs include a # separator, such as person#organization.

sdk.checkGeensIds(['person#organization'], onSuccess, onError);
sdk.getUsersByUids(['user-uid'], onSuccess, onError);

Share an item with users or revoke access

For direct user shares, permission 3 is read/write and 4 is download access. Use the share's access ID when revoking it, rather than the item ID.

sdk.createItemShareForUsers(123, ['person#organization'], 3, onSuccess, onError);
sdk.revokeSharedItemAccess(456, onSuccess, onError);

User data and permissions

getUserData refreshes the SDK's locally stored user data. Its success callback signals completion; it is not a general-purpose user-profile return value.

sdk.getUserData(onSuccess, onError);

const permissions = sdk.geensGroupUserPermissionsList;
const canCreateItems = sdk.checkIfUserHasPermission([permissions.ITEM_CREATE]);

checkIfUserHasPermission throws if no local user data is available. Passing multiple permissions checks whether the user has any of them, subject to the SDK's administrator and personal-account rules. Geens still enforces access on the server.