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

Get additional information from REST API #3414

Closed
1 task done
Bagoult opened this issue Apr 4, 2024 · 2 comments · Fixed by #3416
Closed
1 task done

Get additional information from REST API #3414

Bagoult opened this issue Apr 4, 2024 · 2 comments · Fixed by #3416

Comments

@Bagoult
Copy link
Contributor

Bagoult commented Apr 4, 2024

⚠️ This issue respects the following points: ⚠️

Describe the goal you'd like to achieve

I'm currently developing a polling app for mobile devices for a class project, and I want to make the app compatible with Nextcloud apps so that the user can save and retrieve their polls on a server. I want to be able to get the permissions (addOption, allAccess, etc.) and a summary of the current user (isLoggedIn, isOwner, etc.) for a certain poll, because it allows me to display the poll correctly.
Currently, the only way to get that is to use the list functions through GET /api/v1.0/polls. This does work nicely, but when I want to get information for one poll only through GET /api/v1.0/poll/{pollId}, I only get the configuration of the poll and no user's permissions or interactions. It would be nice to add this to the JSON returned by /poll/{pollId}. I don't know any PHP so I can't make a contribution myself, but I don't think it would take much work to change this. Also, it wouldn't break apps that already use this API. I can help to complete the API docs now that I'm familiar with it if it helps the project.

Describe possible solutions

Modify the get function from here would do it if I understand the code correctly.

Additional context

No response

@dartcafe
Copy link
Collaborator

dartcafe commented Apr 4, 2024

In the next version you find GET /api/v1.0/poll/{pollId}/acl which will return the acl with all set permissions.

Result:

{
  "acl": {
    "pollId": 127,
    "pollExpired": false,
    "pollExpire": 0,
    "currentUser": {
      "displayName": "Dartcafe",
      "hasVoted": true,
      "isInvolved": true,
      "isLoggedIn": true,
      "isNoUser": false,
      "isOwner": true,
      "userId": "dartcafe"
    },
    "permissions": {
      "addOptions": true,
      "allAccess": true,
      "archive": true,
      "comment": true,
      "delete": true,
      "edit": true,
      "pollCreation": true,
      "pollDownload": true,
      "publicShares": true,
      "seeResults": true,
      "seeUsernames": true,
      "seeMailAddresses": true,
      "subscribe": true,
      "view": true,
      "vote": true
    }
  }
}

BUUUUUT: This will change and the permission array will be found as a part of the poll structure (like seen in the rerturn of the list endpoint.

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants