Week 9
Goals for the week
Sl. No. | Initial Goals | Completed |
---|---|---|
1. | Solve requested changes on existing PRs | Done |
2. | Implement and design the API to get all the groups with their repective permssions for a given upload ID | Done |
3. | Creating the upload permissions page in the react UI | Not 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 insidewww/ui/api
directory. - Adding a new method
getGroupsWithPermissions
in theUploadController
class. - Trying to re-use the methods that are already used in the
upload_permissions
plugin. - Testing the API via any API platform like postman.
- Creating a new GET route in the
PR Link : feat(api): PUT api to Set permissions for a upload and GET API to fetch respective permissions of groups #2275
Testing GET /uploads/{id}/perm-groups
-
Pull the changes from the above PR.
-
Use any API platform like postman.
-
Provide the
uploadId
inparams
({id}
) -
If your upload exists, you can expect a response like this. 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.