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

Add permissions to the invite link #258

Merged
merged 3 commits into from
Apr 23, 2024
Merged

Add permissions to the invite link #258

merged 3 commits into from
Apr 23, 2024

Conversation

jatindersingh93
Copy link
Contributor

@jatindersingh93 jatindersingh93 commented Apr 19, 2024

Description

Types of changes

Checklist

  • I have read the CONTRIBUTING doc
  • I have checked that unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

app/src/controllers/invite.js Outdated Show resolved Hide resolved
app/src/controllers/invite.js Outdated Show resolved Hide resolved
Copy link

codeclimate bot commented Apr 19, 2024

Code Climate has analyzed commit 0464e89 and detected 4 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 4

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 68.1% (-0.1% change).

View more on Code Climate.

Copy link

github-actions bot commented Apr 19, 2024

Coverage Report

Totals Coverage
Statements: 61.13% ( 3050 / 4989 )
Methods: 50.99% ( 335 / 657 )
Lines: 68.18% ( 1834 / 2690 )
Branches: 53.65% ( 881 / 1642 )

enformce 1 required element in permCodes array
prevent duplicate perms in array in db
Require MANAGE permission to update a bucket
update codeowners file
app/src/controllers/invite.js Outdated Show resolved Hide resolved
app/src/controllers/invite.js Outdated Show resolved Hide resolved
instance: req.originalUrl,
bucketId: invite.resource
// Grant invitation permission and cleanup
await objectPermissionService.addPermissions(invite.resource, [
Copy link
Contributor

Choose a reason for hiding this comment

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

fyi, the objectPermissionService.addPermissions() method can accept an array of { user,Id, permCode } objects.
eg:

await objectPermissionService.addPermissions(invite.resource, permCodes.map( p => { uswerID: userId, permCode.p }), invite.createdBy);

so maybe you dont need the forEach.. but again.. maybe it's clearer the way you have it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its a good point, i feel like we should redo this part of the code, may be along with BCBOX?

@TimCsaky TimCsaky merged commit 97defba into master Apr 23, 2024
13 checks passed
@TimCsaky TimCsaky deleted the SC3608 branch April 25, 2024 23:59
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.

3 participants