PermissionAPI interface

An interface representing permission related APIs

Methods

checkItemSharingEnabled(CheckItemSharingEnabledInput)

Checks if sharing is enable for current user on this item.

checkPermissionsOfItem(CheckPermissionsOfItemInput)

Checks if the current user has specific permissions on the target item.

checkPermissionsOfWorkspace(CheckPermissionsOfWorkspaceInput)

Checks if the current user has specific permissions on the target workspace.

getItemTypeShareablePermissions(GetItemTypeShareablePermissionsInput)

Gets shareable permissions of the specific item type.

getPermissionsOfItem(GetPermissionsOfItemInput)

Gets permissions of the current user on the target item.

getPermissionsOfItemByUser(GetPermissionsOfItemByUserInput)

Gets permissions of users on the target item.

getPermissionsOfWorkspace(GetPermissionsOfWorkspaceInput)

Gets permissions of the current user on the target workspace.

openItemSharingDialog(ItemSharingDialogConfig)

Opens the item sharing dialog.

openItemSharingDialogWithResult(ItemSharingDialogConfig)

Opens the item sharing dialog with sharing result(Currently only link sharing dialog supports to return sharing result).

Method Details

checkItemSharingEnabled(CheckItemSharingEnabledInput)

Checks if sharing is enable for current user on this item.

function checkItemSharingEnabled(input: CheckItemSharingEnabledInput): Promise<CheckItemSharingEnabledResult>

Parameters

input
CheckItemSharingEnabledInput

CheckItemSharingEnabledInput including:

  • itemType: The item type of the target item.
  • itemObjectId: The object Id of the target item.

Returns

The check result

checkPermissionsOfItem(CheckPermissionsOfItemInput)

Checks if the current user has specific permissions on the target item.

function checkPermissionsOfItem(input: CheckPermissionsOfItemInput): Promise<CheckPermissionsOfItemResult>

Parameters

input
CheckPermissionsOfItemInput

CheckPermissionsOfItemInput including:

  • itemType: The item type of the target item.
  • itemObjectId: The object Id of the target item.
  • permissions: The core permissions to check if user has.
  • itemPermissions: The customized permissions to check if user has.

Returns

The check result

checkPermissionsOfWorkspace(CheckPermissionsOfWorkspaceInput)

Checks if the current user has specific permissions on the target workspace.

function checkPermissionsOfWorkspace(input: CheckPermissionsOfWorkspaceInput): Promise<CheckPermissionsOfWorkspaceResult>

Parameters

input
CheckPermissionsOfWorkspaceInput

CheckPermissionsOfWorkspaceInput including:

  • workspaceObjectId: The object Id of the target workspace.
  • permissions: The permissions to check if user has.

Returns

The check result.

getItemTypeShareablePermissions(GetItemTypeShareablePermissionsInput)

Gets shareable permissions of the specific item type.

function getItemTypeShareablePermissions(input: GetItemTypeShareablePermissionsInput): Promise<GetItemTypeShareablePermissionsResult>

Parameters

input
GetItemTypeShareablePermissionsInput

GetItemTypeShareablePermissionsInput including:

  • itemType: The item type.

Returns

The result is GetItemTypeShareablePermissionsResult which including:

  • corePermissions: The shareable core permissions of this item type.
  • itemPermissions: The shareable item permissions of this item type.

getPermissionsOfItem(GetPermissionsOfItemInput)

Gets permissions of the current user on the target item.

function getPermissionsOfItem(input: GetPermissionsOfItemInput): Promise<GetPermissionsOfItemResult>

Parameters

input
GetPermissionsOfItemInput

GetPermissionsOfItemInput including:

  • itemType: The item type of the target item.
  • itemObjectId: The object Id of the target item.

Returns

The result is GetPermissionsOfItemResult which including:

  • permissions: The core permissions user has.
  • itemPermissions: The customized permissions user has. Always return 0 for non-fabric items.

getPermissionsOfItemByUser(GetPermissionsOfItemByUserInput)

Gets permissions of users on the target item.

function getPermissionsOfItemByUser(input: GetPermissionsOfItemByUserInput): Promise<GetPermissionsOfItemByUserResult>

Parameters

input
GetPermissionsOfItemByUserInput

GetPermissionsOfItemByUserInput including:

  • itemObjectId: The object Id of the target item.
  • userObjectIds: The object Id list of users to query.

Returns

The result is GetPermissionsOfItemByUserResult which including:

  • permissionUsers: The list to map users being queried and their permissions to the item.

getPermissionsOfWorkspace(GetPermissionsOfWorkspaceInput)

Gets permissions of the current user on the target workspace.

function getPermissionsOfWorkspace(input: GetPermissionsOfWorkspaceInput): Promise<GetPermissionsOfWorkspaceResult>

Parameters

input
GetPermissionsOfWorkspaceInput

GetPermissionsOfWorkspaceInput including:

  • workspaceObjectId: The object Id of the target workspace.

Returns

The result is GetPermissionsOfWorkspaceResult which including:

  • permissions: The permissions user has.

openItemSharingDialog(ItemSharingDialogConfig)

Opens the item sharing dialog.

function openItemSharingDialog(config: ItemSharingDialogConfig)

Parameters

config
ItemSharingDialogConfig

ItemSharingDialogConfig including:

  • itemType: The item type of the target item.
  • itemObjectId: The object Id of the target item.
  • linkSharing: If this flag is true, open link sharing dialog, otherwise open direct sharing dialog. - Optional with default value true
  • preSelectedUserPrincipals: A list of user principal names to grant access by default. - Optional. Only supported in direct sharing dialog
  • defaultShareOptions: A list of share option names to be checked by default. - Optional. Only supported in direct sharing dialog. Note that empty array is different from undefined and will uncheck all share options
  • customizedTitle: A customized title to replace grant access title in sharing literals. Needs to be localized. - Optional and only supported in direct sharing dialog

openItemSharingDialogWithResult(ItemSharingDialogConfig)

Opens the item sharing dialog with sharing result(Currently only link sharing dialog supports to return sharing result).

function openItemSharingDialogWithResult(config: ItemSharingDialogConfig): Promise<SharingResult>

Parameters

config
ItemSharingDialogConfig

ItemSharingDialogConfig including:

  • itemType: The item type of the target item.
  • itemObjectId: The object Id of the target item.
  • linkSharing: If this flag is true, open link sharing dialog, otherwise open direct sharing dialog. - Optional with default value true
  • preSelectedUserPrincipals: A list of user principal names to grant access by default. - Optional. Only supported in direct sharing dialog
  • defaultShareOptions: A list of share option names to be checked by default. - Optional. Only supported in direct sharing dialog. Note that empty array is different from undefined and will uncheck all share options
  • customizedTitle: A customized title to replace grant access title in sharing literals. Needs to be localized. - Optional and only supported in direct sharing dialog

Returns

Promise<SharingResult>

The result is SharingResult which including:

  • sharingCompleted: If the sharing has been completed successfully.
  • scope: If the sharing is tenant scope sharing, specific users sharing or existing access(no new sharing)
  • sharedUsers: object id of shared users
  • permissions: shared core permissions
  • itemPermissions: shared customized permissions
  • relatedSharingPermissions: shared permissions of related item