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

Up roles defaults #7965

Merged
merged 3 commits into from
Feb 10, 2023
Merged

Up roles defaults #7965

merged 3 commits into from
Feb 10, 2023

Conversation

diocas
Copy link
Contributor

@diocas diocas commented Nov 14, 2022

Follow up to what we discussed in our last meeting (some weeks ago).
This is not final yet (the tests are failing, and I need to check why, as the default behaviour should stay the same...) and I would appreciate feedback.

The Contributor role is now optional, since we do not support it in CERBox.

It also makes the re-sharing permission optional, as allowing re-sharing doesn't mean we want to make it the default.
We discussed this and you were ok with the change, but now I see that oCIS is not honouring the change... Example: I have re-sharing default to false, in the share dialog I set the Viewer role, the request sends the proper permission code (1), together with the role name, but oCIS replies with the sharing permission (1 + 16). Is it using the role name to define the permissions?
Also, the implementation might need some suggestions...

@update-docs
Copy link

update-docs bot commented Nov 14, 2022

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@diocas diocas marked this pull request as draft November 14, 2022 17:24
@diocas diocas force-pushed the up_roles_defaults branch from 2ac7321 to 1d05622 Compare February 8, 2023 15:45
@diocas diocas requested a review from kulmann February 8, 2023 15:45
@diocas diocas marked this pull request as ready for review February 8, 2023 15:45
@diocas
Copy link
Contributor Author

diocas commented Feb 8, 2023

@kulmann I think I solved the tests' issues... Ready for review.

@diocas diocas force-pushed the up_roles_defaults branch from 1d05622 to 530f00d Compare February 8, 2023 15:46
Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

One issue about the order of link share roles in the dropdown (see comment). Other than that everything fine, so if you get that fixed I'll merge.

packages/web-client/src/helpers/share/role.ts Outdated Show resolved Hide resolved
@diocas diocas force-pushed the up_roles_defaults branch from 530f00d to 11c4e9c Compare February 9, 2023 22:05
@diocas
Copy link
Contributor Author

diocas commented Feb 9, 2023

Made some changes in the tests. Let me know if it's not ok. Maybe we could extend the tests as well.

@sonarcloud
Copy link

sonarcloud bot commented Feb 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

71.4% 71.4% Coverage
0.0% 0.0% Duplication

...(canEditFile ? [linkRoleEditorFile] : [])
].filter((r) => r.folder === isFolder)
}

static getByBitmask(bitmask: number, isFolder: boolean): ShareRole {
return [...this.all, linkRoleEditorFile, linkRoleInternalFile, linkRoleInternalFolder] // Always return all roles
.find((r) => r.folder === isFolder && r.bitmask(false) === bitmask)
return this.list(isFolder, true, true, true, false).find((r) => r.bitmask(false) === bitmask)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This means 2 finds, but the list is small.. Let me know if you prefer this more optimized.

Copy link
Member

Choose a reason for hiding this comment

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

that's fine. I prefer the readability over the performance in this case (like you said, only few items in the list).

Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

👍

...(canEditFile ? [linkRoleEditorFile] : [])
].filter((r) => r.folder === isFolder)
}

static getByBitmask(bitmask: number, isFolder: boolean): ShareRole {
return [...this.all, linkRoleEditorFile, linkRoleInternalFile, linkRoleInternalFolder] // Always return all roles
.find((r) => r.folder === isFolder && r.bitmask(false) === bitmask)
return this.list(isFolder, true, true, true, false).find((r) => r.bitmask(false) === bitmask)
Copy link
Member

Choose a reason for hiding this comment

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

that's fine. I prefer the readability over the performance in this case (like you said, only few items in the list).

@kulmann kulmann merged commit bc05a41 into owncloud:master Feb 10, 2023
@micbar micbar mentioned this pull request May 3, 2023
89 tasks
@diocas diocas deleted the up_roles_defaults branch July 24, 2023 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants