You are here

public function CmisConnectionApi::hasAllowableActionById in CMIS API 3.0.x

Same name and namespace in other branches
  1. 8.2 src/CmisConnectionApi.php \Drupal\cmis\CmisConnectionApi::hasAllowableActionById()

Check if object id has the allowable action.

Parameters

string $id: CMIS object ID.

string $action: Get action.

Return value

bool Return TRUE if object id has the allowable action.

File

src/CmisConnectionApi.php, line 373

Class

CmisConnectionApi
Description of CmisConnectionApi.

Namespace

Drupal\cmis

Code

public function hasAllowableActionById($id, $action) {
  if (empty($id)) {
    return FALSE;
  }
  $cid = $this->session
    ->createObjectId($id);
  $object = $this->session
    ->getObject($cid);
  $get_actions = $object
    ->getAllowableActions()
    ->getAllowableActions();
  foreach ($get_actions as $get_action) {
    if ($get_action
      ->equals($action)) {
      return TRUE;
    }
  }
  return FALSE;
}