Skip to content

Conversation

@tcnichol
Copy link
Contributor

Making this a draft pull request so it's easier to get feedback.

Current problem is that backend methods seem to work, but I'm getting nothing on the front end.
Not sure why,will work on this.

@tcnichol tcnichol linked an issue Mar 17, 2023 that may be closed by this pull request
@tcnichol tcnichol marked this pull request as ready for review March 24, 2023 20:35
@tcnichol
Copy link
Contributor Author

I have marked this ready for review.

To test, create some groups.
Add some groups and users to datasets with different roles.
Under the 'sharing' tab, you will see 2 tables.
One is for the Groups that have access
The other is for the Users.
Decided to just open this one up that displays only (the button to change access does not work.)

Copy link
Member

@lmarini lmarini left a comment

Choose a reason for hiding this comment

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

Left a few minor comments.

dataset_id: str,
db: MongoClient = Depends(dependencies.get_db),
allow: bool = Depends(Authorization("editor")),
):
Copy link
Member

Choose a reason for hiding this comment

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

Please add docs.

@router.get(
"/datasets/{dataset_id}/groups_and_roles", response_model=List[GroupAndRole]
)
async def get_dataset_groups_and_roles(
Copy link
Member

Choose a reason for hiding this comment

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

Please add method docs.

{"dataset_id": ObjectId(dataset_id)}
):
current_authorization = AuthorizationOut.from_mongo(auth)
if len(current_authorization.group_ids) == 0:
Copy link
Member

Choose a reason for hiding this comment

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

This checks if there is no groups associated, but shouldn't it check if there is users associated with it? similar to the group one below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed that.



@router.get("/datasets/{dataset_id}/users_and_roles", response_model=List[UserAndRole])
async def get_dataset_users_and_roles(
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why the two methods need to be separate? Wouldn't it be easier to just have one method that returns all users and groups? Or are there situations where it makes sense for the client to only ask about one and not the other?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was part of my thinking. Users and Groups are also different in terms of their fields and how they are used for permissions, so I couldn't figure out 1 solution for both. For users you add their email to the dataset with a role, but for groups you add the actual uuid to the dataset with the role and not the group name. Using 1 object looked like it would require a bunch of extra checks for whether it's a group or a user, so I just did 2 separate object types with 2 endpoints.

}

return (
<TableContainer>
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a card, or white background similar to what we have in other tabs to make those tables consistent?

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 added a card.

…fo-right-next-to-each-of-the-resource' into 377-ui-display-group-and-user-info-right-next-to-each-of-the-resource
@max-zilla
Copy link
Contributor

Check if the UI is filtering out users that are also in a group, if so can we display even if they are also in a group with same role? if it is done on API side, we can go ahead with this and create a separate issue to fix the API filter.

Original comment:

the one behavior that is in the "Sharing Tab" i will clarify is:
10:51
I add luigi as Editor to the dataset.
I add luigi to Team1 group.
I add Team1 as Viewer to the dataset.
10:52
it will show luigi as editor under Users and group under Viewer. this is in my screenshot - mburnet88 is in the test group 2, but since i have a separate Viewer role that is also shown.
10:53
however, if mburnet88 had EDITOR role AND is in a group with editor role, only the group is shown. in the database, we keep the difference - we know that if the group is removed, mburnet88 should be kept as editor because they were added separately
10:53
but the UI does not show mburnet88 in Users list, I'm guessing UI sees that email in the list of group members and hides it.
10:54
but, this is hiding a tiny piece of info, "if you remove the group, mburnet88 will still have Viewer access"
10:54
how do people feel about this? (if it makes sense)
10:54
basically i think we should show individual user entries even if they are in a group as well, incases where user has both individual + group assignment of same role. (edited)

…s an authorization separate from a group, then it will show here
@tcnichol
Copy link
Contributor Author

tcnichol commented Mar 30, 2023

Check if the UI is filtering out users that are also in a group, if so can we display even if they are also in a group with same role? if it is done on API side, we can go ahead with this and create a separate issue to fix the API filter.

Original comment:

the one behavior that is in the "Sharing Tab" i will clarify is: 10:51 I add luigi as Editor to the dataset. I add luigi to Team1 group. I add Team1 as Viewer to the dataset. 10:52 it will show luigi as editor under Users and group under Viewer. this is in my screenshot - mburnet88 is in the test group 2, but since i have a separate Viewer role that is also shown. 10:53 however, if mburnet88 had EDITOR role AND is in a group with editor role, only the group is shown. in the database, we keep the difference - we know that if the group is removed, mburnet88 should be kept as editor because they were added separately 10:53 but the UI does not show mburnet88 in Users list, I'm guessing UI sees that email in the list of group members and hides it. 10:54 but, this is hiding a tiny piece of info, "if you remove the group, mburnet88 will still have Viewer access" 10:54 how do people feel about this? (if it makes sense) 10:54 basically i think we should show individual user entries even if they are in a group as well, incases where user has both individual + group assignment of same role. (edited)

I think I now have it where if a user has a separate role from their role as part of a group that shows under the Users and Roles table. I tested by creating a group and giving the group a 'Viewer' role, but then giving one of the users in the group the 'uploader' role. I don't see an entry for that user for 'viewer' but I do see it for 'uploader.'

And if the role is the same it shows as well. So if a user has 'editor' role and a group has 'editor' role, the user shows up under Users and Roles.

@max-zilla
Copy link
Contributor

please resolve merge conflicts

tcnichol and others added 3 commits April 4, 2023 13:01
…t-to-each-of-the-resource

# Conflicts:
#	backend/app/models/users.py
#	frontend/src/types/action.ts
#	frontend/src/types/data.ts
@max-zilla max-zilla requested a review from lmarini April 5, 2023 15:33
@max-zilla max-zilla merged commit b1ec37d into main Apr 5, 2023
@max-zilla max-zilla deleted the 377-ui-display-group-and-user-info-right-next-to-each-of-the-resource branch April 5, 2023 16:34
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.

UI display group and user info right next to each of the resource

4 participants