Skip to content

Use v2 api to get project collaborators and their project permission#348

Merged
MarcelGeo merged 16 commits intodevelopfrom
fe_get_project_collaborators
Jan 7, 2025
Merged

Use v2 api to get project collaborators and their project permission#348
MarcelGeo merged 16 commits intodevelopfrom
fe_get_project_collaborators

Conversation

@harminius
Copy link
Contributor

Use new API to list project collaborators. Add a function to calculate real project permission from the project and workspace role.

Screenshot from 2024-12-18 11-56-41

@coveralls
Copy link

coveralls commented Dec 18, 2024

Pull Request Test Coverage Report for Build 12432514437

Details

  • 14 of 17 (82.35%) changed or added relevant lines in 5 files are covered.
  • 24 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.5%) to 93.059%

Changes Missing Coverage Covered Lines Changed/Added Lines %
server/mergin/sync/workspace.py 0 3 0.0%
Files with Coverage Reduction New Missed Lines %
server/mergin/sync/private_api_controller.py 4 92.99%
server/mergin/sync/workspace.py 20 85.07%
Totals Coverage Status
Change from base Build 12374107552: -0.5%
Covered Lines: 6543
Relevant Lines: 7031

💛 - Coveralls

project_role: ProjectRoleName,
workspace_role: WorkspaceRoleName
): ProjectRoleName {
const mappedWorkspaceRole: ProjectRoleName =
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can use mapper here WorkspaceRole -> ProjectRole

const projectRoleIndex = ROLE_HIERARCHY.indexOf(project_role)
const workspaceRoleIndex = ROLE_HIERARCHY.indexOf(mappedWorkspaceRole)

return projectRoleIndex > workspaceRoleIndex
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need calculate project role only if it's null. If not null -> stay same as before. I think we do not need such logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A workspace role higher than a project role is a valid scenario, no? See user id 6...

Screenshot from 2024-12-18 11-56-41

Copy link
Collaborator

Choose a reason for hiding this comment

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

We have deal with @varmar05 , that BE will return new role attribute which will be calculated role. We can then use it in dropdown and project_role will be used just for add / update project collaborator handling.

MarcelGeo and others added 11 commits December 18, 2024 16:54
- remove project collaborator/update project collaboratr methods in store.ts - replace for access methods
- add role (aka project_permission) - combination of workspace_role and project_role to Project collaborator response
- adjust FE API
@MarcelGeo MarcelGeo merged commit f80c82b into develop Jan 7, 2025
@MarcelGeo MarcelGeo deleted the fe_get_project_collaborators branch January 7, 2025 08:32
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.

4 participants