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
feat(api): PUT api to Set permissions for a upload and GET API to fetch respective permissions of groups #2275
Conversation
bfc3160
to
6a6d830
Compare
/uploads/{id}/permissions
PUT api to Set permissions for a…
6a6d830
to
d12097e
Compare
@krishna9304 apologies, I pressed the wrong button an pushed the merge commit to the branch. Can you please rebase it with current master and remove the merge commit? |
Sure, I'll do that! |
0832c06
to
2c9c58f
Compare
2c9c58f
to
642d2fa
Compare
642d2fa
to
227e474
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
227e474
to
ad951df
Compare
/uploads/{id}/permissions
PUT api to Set permissions for a…
Please keep in mind the REST API is not designed solely for the purpose of UI implementation. It can be consumed by others as well. Using indexed array can cause issues with some programming languages. However, simple array can be iterated over and filtered based on inner Moreover, I am not sure the array will be so big for a single upload that it will cause significant computational delay if all the elements have to be iterated over. |
Sure then, I'm changing the response to be an array. @GMishx |
ad951df
to
597b1fe
Compare
@krishna9304 some changes are required in open api docs diff --git a/src/www/ui/api/documentation/openapi.yaml b/src/www/ui/api/documentation/openapi.yaml
index 82e1a7e5d..7d3598c43 100644
--- a/src/www/ui/api/documentation/openapi.yaml
+++ b/src/www/ui/api/documentation/openapi.yaml
@@ -677,7 +677,7 @@ paths:
Set permissions for a upload in a folder for different groups
requestBody:
content:
- application/x-www-form-urlencoded:
+ application/json:
schema:
type: object
properties:
@@ -2351,18 +2351,17 @@ components:
type: string
description: Public permission for the upload
permGroups:
- type: object
+ type: array
description: Indexed Object of GroupIds with their respective permissions for a upload
- properties:
- groupId:
- type: object
- properties:
- perm:
- type: string
- group_pk:
- type: string
- group_name:
- type: string
+ items:
+ type: object
+ properties:
+ perm:
+ type: string
+ group_pk:
+ type: string
+ group_name:
+ type: string
UrlUpload:
description: To create an upload from a URL
type: object |
yes, may be I missed that, I'm fixing it right away. |
… upload in a folder for different groups /uploads/{id}/perm-groups GET api to get all the groups with their respective permissions for a upload Signed-off-by: Krishna Mahato<krishhtrishh9304@gmail.com>
597b1fe
to
54f8053
Compare
@GMishx Fixed api docs. |
Signed-off-by: Gaurav Mishra <mishra.gaurav@siemens.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks good.
Tested, working as expected.
Signed-off-by : Krishna Mahato krishhtrishh9304@gmail.com
Description
Now,
/api/v1/uploads/{id}/permissions
that will Set permissions for a upload in a folder for different groups./api/v1/uploads/{id}/perm-groups
that will return all the groups with their respective permissions for a upload.Here
{id} : is the upload Id
.How to test
To test
PUT /api/v1/uploads/{id}/permissions
To test
GET /api/v1/uploads/{id}/perm-groups
PTAL : @GMishx @Shruti3004
This closes #2270 .