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

[VO-435] feat(SharingCollection): Add revokeGroup #1454

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

cballevre
Copy link
Contributor

No description provided.

/**
* Revoke only one group of the sharing.
*
* @param {object} sharing Sharing Object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it this one ?

* 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?

Copy link
Contributor Author

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}`
)
}
Copy link
Contributor

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)

Copy link
Contributor Author

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 ?

Copy link
Contributor

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.

@cballevre cballevre force-pushed the feat/add-revoke-group-into-sharing-collection branch from 28480d5 to 3c9758c Compare March 19, 2024 14:56
@cballevre cballevre requested a review from Crash-- March 19, 2024 15:56
@cballevre cballevre force-pushed the feat/add-revoke-group-into-sharing-collection branch from 3c9758c to 3dc066b Compare March 19, 2024 16:05
@cballevre cballevre merged commit 9f7b3b8 into master Mar 19, 2024
4 checks passed
@cballevre cballevre deleted the feat/add-revoke-group-into-sharing-collection branch March 19, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants