Skip to main content

Week 9

Goals for the week

Sl. No.Initial GoalsCompleted
1.Solve requested changes on existing PRsDone
2.Implement and design the API to get all the groups with their repective permssions for a given upload IDDone
3.Creating the upload permissions page in the react UINot Started

REST API Implemented -

As the below API is a part of the upload-permissions functionality, I added the REST implementation in the same PR#2275.

Designing GET /uploads/{id}/perm-groups

I figured out the requirements of this API and designed the following :

/uploads/{id}/perm-groups:
parameters:
- name: id
required: true
description: Id of the upload
in: path
schema:
type: integer
get:
operationId: getGroupsWithPermissions
tags:
- Upload
summary: Get all the groups with their respective permissions for a upload
description:
Returns the list of all the groups with their respective permissions for a upload
responses:
'200':
description: Get Groups with permissions
content:
application/json:
schema:
$ref: '#/components/schemas/UploadPermGroups'
'404':
description: Upload does not exist
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Info'
default:
$ref: '#/components/responses/defaultResponse'

Implementation :

  • The API implementation of the /uploads/{id}/perm-groups GET route to get all the groups with their respective permissions for a upload is done.
  • This task included
    • Creating a new GET route in the index.php file inside www/ui/api directory.
    • Adding a new method getGroupsWithPermissions in the UploadControllerclass.
    • Trying to re-use the methods that are already used in the upload_permissions plugin.
    • Testing the API via any API platform like postman.

Testing GET /uploads/{id}/perm-groups

  • Pull the changes from the above PR.

  • Use any API platform like postman.

  • Provide the uploadId in params ({id})

  • If your upload exists, you can expect a response like this. res-perm-groups Note: The above response also gives the publicPerm parameter which states the public permissions of the upload.

Conclusions and further plans

  • This PR is currently in review and if any changes are requested, I'll be solving them in the coming week.
  • Creating the upload permissions page in the react UI and implementing the APIs created.