Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLAT-24975: Validate user when editing Annotation Cue Points on entries #12964

Merged
merged 2 commits into from
Nov 11, 2024

Conversation

drorsou
Copy link
Collaborator

@drorsou drorsou commented Nov 7, 2024

No description provided.

@drorsou drorsou merged commit 894c860 into Ursa-21.3.0 Nov 11, 2024
@drorsou drorsou deleted the Ursa-21.3.0-PLAT-24975 branch November 11, 2024 10:34
Copy link
Contributor

@muli muli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@inbal-ben-david, @drorsou - please see my comment on this one.

}
protected function validateEntryEntitlement(entry $dbEntry, $tags)
{
if (!kEntitlementUtils::isEntryEntitled($dbEntry) && str_contains($tags, 'hotspots'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I have a cue-point with the following tags:

  • coolhotspots
  • tag2
  • tag3

which translates into coolhotspots,tag2,tag3 in the DB (and in the API entry object) - this restriction will apply there, which is unexpected.
I think that you should do something like

$tags = explode(',', $tags);
if (in_array('hotspots', $tags) && !kEntitlementUtils::isEntryEntitled($dbEntry)) {
    // throw error
}

Also notice the order of the conditions - isEntryEntitled will not execute if hotspots isn't one of the tags, which might be performance improvement.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened a new PR #12969

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants