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

Global users aren't able to cast the vote on subwiki's poll #111

Open
petrenkonikita112263 opened this issue Dec 27, 2024 · 4 comments · Fixed by #114
Open

Global users aren't able to cast the vote on subwiki's poll #111

petrenkonikita112263 opened this issue Dec 27, 2024 · 4 comments · Fixed by #114

Comments

@petrenkonikita112263
Copy link

petrenkonikita112263 commented Dec 27, 2024

Prerequisites:

  • XWiki instance 16.10.1.
  • Installed globally (on the farm) Polls application v.2.3 (at the time this issue was filed)
  • Trial license
  • Created a normal user (member of XWikiAllGroup)
  • Created subwiki that is open for global users

image

Step to reproduce:

  1. Being logged as XWiki Admin, create any vote with the status Active
  2. Make a vote
  3. Log in as another user and try to vote

Actual result:
Global users can select options but aren't able to save their votes. The XWiki will return the error "Not allowed to vote!". The browser will have this request PUT http://localhost/xwiki/rest/wikis/test/spaces/XPoll/spaces/Test+Poll/pages/WebHome/xpoll, which returns a 403 status code.

Expected result:
Global users are able to save their votes.

@petrenkonikita112263
Copy link
Author

petrenkonikita112263 commented Dec 27, 2024

This might be the issue with the voting method in a conditional statement.

public Response vote(String wikiName, String spaces, String pageName, Vote vote) throws XWikiRestException

Note that the issue is reproducible on XWiki 14.10, which uses old-core API. The reason why it's reproducable on higher versions, as the API was changed since 16.10.0+

Once I invited user into created subwiki that user can save the vote on created poll.

@KebabRonin
Copy link

KebabRonin commented Jan 28, 2025

This is the intended behavior. Since the user is not part of the subwiki, the user doesn't have edit rights and can't vote. They have to join first by joining from the Wiki Index or being added by Admin.

So the solution is to give the user edit rights on the poll page, either by joining the subwiki as mentioned above, or to change the user rights for the page/wiki to grant users from the main wiki XWikiAllGroup edit rights for the subwiki poll.

Maybe related to this improvement: #112.

@petrenkonikita112263
Copy link
Author

thx @KebabRonin for checks and input

@snazare
Copy link

snazare commented Feb 18, 2025

reopened as we misunderstood the issue. We need to allow users to vote even though they don't have edit rights. We should replace edit check with the user not being guest and having view right on the poll

KebabRonin added a commit to KebabRonin/application-xpoll that referenced this issue Feb 19, 2025


* Changed rights requirements for voting
* Added unit tests for voting with different rights
KebabRonin added a commit to KebabRonin/application-xpoll that referenced this issue Feb 21, 2025
KebabRonin added a commit that referenced this issue Feb 21, 2025
* Changed rights requirements for voting
* Added unit tests for voting with different rights
@KebabRonin KebabRonin moved this from Todo to Done in Pro Apps Roadmap Feb-March 2025 Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

4 participants