Skip to content

Commit

Permalink
Merge pull request #1113 from tripal/1112-tv3-web_services_field_entity
Browse files Browse the repository at this point in the history
Added fix for issue #1112
  • Loading branch information
laceysanderson committed Oct 20, 2020
2 parents 565f1e9 + 120fa5b commit 493e4a7
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,9 @@ class TripalContentService_v0_1 extends TripalWebService {
// Index number (0, 1, 2...) of a hydra:member array.
$temp[$k] = $this->sanitizeFieldKeys($resource, $v, $bundle, $service_path);
}
elseif ($k == 'entity') {
$temp[$k] = $v;
}
else {
// TODO: this is an error, if we get here then we have
// a key that isn't using the proper format... what to do?
Expand Down Expand Up @@ -879,13 +882,13 @@ class TripalContentService_v0_1 extends TripalWebService {

// Get the TripalBundle, TripalTerm and TripalVocab type for this type.
$bundle = tripal_load_bundle_entity(['label' => $ctype]);

// Check that the user has access to this bundle. If not then the
// function call will throw an error.
if (!user_access('view ' . $bundle->name)) {
throw new Exception("Permission Denied.");
}

$term = entity_load('TripalTerm', ['id' => $bundle->term_id]);
$term = reset($term);

Expand Down Expand Up @@ -1058,7 +1061,7 @@ class TripalContentService_v0_1 extends TripalWebService {
// Show only content types users have access to and skip the rest.
continue;
}

$entity = entity_load('TripalTerm', ['id' => $bundle->term_id]);
$term = reset($entity);
$vocab = $term->vocab;
Expand Down

0 comments on commit 493e4a7

Please sign in to comment.