-
Notifications
You must be signed in to change notification settings - Fork 13
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
[VO-435] feat(SharingCollection): Add revokeGroup #1454
[VO-435] feat(SharingCollection): Add revokeGroup #1454
Conversation
/** | ||
* Revoke only one group of the sharing. | ||
* | ||
* @param {object} sharing Sharing Object |
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.
is it this one ?
cozy-client/packages/cozy-stack-client/src/SharingCollection.js
Lines 73 to 84 in 28480d5
* Creates a new Sharing. See https://docs.cozy.io/en/cozy-stack/sharing/#post-sharings | |
* | |
* @param {object} params Sharing params | |
* @param {Sharing} params.document The document to share | |
* @param {string} params.description Description of the sharing | |
* @param {string=} params.previewPath The preview path | |
* @param {Array<Rule>=} params.rules The rules defined to the sharing. See https://docs.cozy.io/en/cozy-stack/sharing-design/#description-of-a-sharing | |
* @param {Array<Recipient>=} params.recipients Recipients to add to the sharings (will have the same permissions given by the rules defined by the sharing ) | |
* @param {Array<Recipient>=} params.readOnlyRecipients Recipients to add to the sharings with only read only access | |
* @param {boolean=} params.openSharing If someone else than the owner can add a recipient to the sharing | |
* @param {string=} params.appSlug Slug of the targeted app | |
*/ |
If yes, maybe we can create the type and use it instead of object
?
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.
No, it didn't match that one, but you're right to point out the lack of type. I've added the description of the object which was an io.cozy.sharing
document
'DELETE', | ||
uri`/sharings/${sharing._id}/groups/${groupIndex}` | ||
) | ||
} |
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.
Can't we expose this method via the DSL? (aka destroy)
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.
I'm wondering if this makes sense because we're not deleting the io.cozy.sharing document, just modifying it. The other cases of revocation would have to be managed at the same time. That's how I'd imagine the api would look:
Revoke a group :
client.collection('io.cozy.sharing').destroy(sharingDocument, {
group: 1
})
Revoke a recipient :
client.collection('io.cozy.sharing').destroy(sharingDocument, {
recipient: 0
})
Defining for revocation of all recipients bother me a little in terms of naming. Was it something like this that you saw ?
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.
I don't have any clue, I just know that since you are bypassing the store, you'll have to update the state manually.
I'll try to move on being able to call any method from the query (client.query(Q('io.cozy.sharings').call('revokeGroup', {})), it should fix the issue.
28480d5
to
3c9758c
Compare
3c9758c
to
3dc066b
Compare
No description provided.