Problem/Motivation

When creating an OpenAgenda node, constraint validation is made by calling the hasPermission function from openagenda sdk. That method calls "/v2/me/agendas" endpoint which needs admin rights. But a given public key may be able to fetch events from public agenda without needing to have admin rights.

Proposed resolution

Try to get at least the first event when validating OpenAgenda node to ensure read right is ok.

Issue fork openagenda-3443188

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sgostanyan created an issue. See original summary.

sgostanyan’s picture

sgostanyan’s picture

Issue summary: View changes
sgostanyan’s picture

Status: Active » Needs review
pacproduct’s picture

Status: Needs review » Reviewed & tested by the community

@sgostanyan's patch in #2 solved a fatal error I had when submitting an open agenda content type:

Uncaught PHP Exception TypeError: "OpenAgendaSdk\OpenAgendaSdk::hasPermission(): Argument #1 ($agendaUid) must be of type int, string given, called in /var/www/public/modules/contrib/openagenda/src/Plugin/Validation/Constraint/OpenagendaPermissionValidator.php on line 42

Thanks!

mably’s picture

Status: Reviewed & tested by the community » Needs work

Can we have an MR please?

shamir.vs made their first commit to this issue’s fork.

mably’s picture

The event parameter format check is now done in the param converter instead of the routing requirement.

No more WSOD but a prettier 404 instead.

Seems far better, let's merge this.

  • mably committed 3fb919f9 on 4.x
    fix: #3443188 Wrong way to check Node constraint validation
    
    By:...
mably’s picture

Version: 3.4.8 » 4.x-dev
Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

mably’s picture

Status: Fixed » Needs work

mably changed the visibility of the branch 3443188-wrong-way-to to hidden.

mably’s picture

Status: Needs work » Needs review
mably’s picture

Still wondering why hasPermission was used in the first place. An idea anyone?

Is it a requirement from OpenAgenda?

  • mably committed d566b480 on 4.x
    fix: #3443188 Wrong way to check Node constraint validation
    
    By:...
mably’s picture

Status: Needs review » Fixed

Let's merge this and see how things go.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.