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

Org page improvements #888

Merged
merged 48 commits into from
Jul 4, 2024
Merged

Org page improvements #888

merged 48 commits into from
Jul 4, 2024

Commits on Jul 2, 2024

  1. Configuration menu
    Copy the full SHA
    76390a3 View commit details
    Browse the repository at this point in the history
  2. Hide "Leave Org" button for non-members

    Site admins can view any org page, but shouldn't see a "Leave Org"
    button unless they're actually members of the org.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    0c13553 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1a934c0 View commit details
    Browse the repository at this point in the history
  4. Initial implementation of org projects GQL auth

    Commented out for now because "orgs can own projects" PR needs to be
    merged before this will compile.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    f5b446a View commit details
    Browse the repository at this point in the history
  5. Put list of orgs in JWT, like project list

    This will be useful for enforcing GQL permissions such as "non-members
    can only see the list of admins, members can see other members".
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    a5ed538 View commit details
    Browse the repository at this point in the history
  6. Correct semantics for org members field filtering

    Non-org members are allowed to see the list of org admins, so we
    shouldn't throw an exception here.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    03fa852 View commit details
    Browse the repository at this point in the history
  7. Slightly simpler Members middleware implementation

    Now that the orgs are listed in the JWT, we could have a slightly
    simpler implementation of the org.Members field GQL middleware.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    4ff38f8 View commit details
    Browse the repository at this point in the history
  8. No need to handle orgs claims specially

    We handle project claims specially because some users can be in many,
    many projects, and so we need to squeeze every byte that we can. But for
    orgs, most users will be in just one, and those who are in more than one
    are usually going to be in just two or three. So we can just do a simple
    array and let the standard JSON serialization handle it.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    96889fe View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    ae267da View commit details
    Browse the repository at this point in the history
  10. Adjust o.Projects GraphQL logic

    This allows org admins to see all projects, but org members just get to
    see public projects the same way that non-members do (we might adjust
    that in the future).
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    5c81fed View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    c821322 View commit details
    Browse the repository at this point in the history
  12. Move org fields middleware into separate classes

    Now that these functions are starting to get quite long, they probably
    belong in their own classes so that OrgGqlConfiguration stays readable.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    c63600e View commit details
    Browse the repository at this point in the history
  13. Hide email column on org page from non-admins

    Only site admins are allowed to retrieve users' email addresses, so only
    site admins should be shown emails on the org page's members table.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    d760eb6 View commit details
    Browse the repository at this point in the history
  14. Improve GraphQL logic for org.Projects list

    There's no need to throw an exception if the org ID can't be found; just
    handle that situation the same way as if a non-member were sending the
    GraphQL query, and return only public projects just to be safe.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    458a54b View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    e04b813 View commit details
    Browse the repository at this point in the history
  16. Fix type errors in user.ts

    The createGuestUserByAdmin function in user.ts is typed as returning a
    LexAuthUser, which means that it needs the new `orgs` property in order
    to pass the type test. So we need to query it from the GraphQL result.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    e252180 View commit details
    Browse the repository at this point in the history
  17. Add OrgMemberById query

    This will allow org admins to see all details (including email
    addresses) of users in the orgs they manage.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    0c0f378 View commit details
    Browse the repository at this point in the history
  18. Attempt to use orgMemberById query in frontend

    Not working yet due to type errors.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    f8bea36 View commit details
    Browse the repository at this point in the history
  19. Get org member GQL query working

    myieye authored and rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    2b00283 View commit details
    Browse the repository at this point in the history
  20. Forbid non-project members from loading project page

    Now that orgs can own projects, and anyone can see the list of projects
    that an org owns, non-project members will sometimes be clicking on
    project links. Changing the project table to hide links if the viewer
    doesn't have permission is complicated, so for now we'll go with the
    simple expedient of showing a 404 page if the user clicks on a link to a
    project he's not supposed to see. We'll change this later.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    a026b46 View commit details
    Browse the repository at this point in the history
  21. Revert "Forbid non-project members from loading project page"

    This reverts commit 349556c.
    
    Going to take a different approach: create a new permission called
    CanViewProject, and rename CanAccessProject to CanSyncProject.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    e884b0b View commit details
    Browse the repository at this point in the history
  22. Rename CanAccessProject to CanSyncProject

    We'll create a new CanViewProject permission for read-only access to the
    project metadata without repo access.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    fbaabf8 View commit details
    Browse the repository at this point in the history
  23. Use ViewProject permission in ProjectByCode query

    This allows public projects to let anyone view them, but still requires
    project membership in order to access the repository.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    f174aa1 View commit details
    Browse the repository at this point in the history
  24. Have test org own elawa project at startup

    This will allow testing that people who are not members of an org can
    only see projects that are truly public (isConfidential == false) and
    not projects where isConfidential == null. In order words, testing that
    we're not failing open for projects with unknown confidentiality.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    75718b8 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    6965bd9 View commit details
    Browse the repository at this point in the history
  26. Query project confidentiality in org page GQL

    This is needed so that OrgProjectsVisibilityMiddleware can actually see
    the isConfidential value. If isConfidential is not included in the GQL
    query then the middleware sees it as null and defaults to private, thus
    hiding projects that would have been visible.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    a400a0c View commit details
    Browse the repository at this point in the history
  27. Mention need for correct middleware order

    Also remove no-longer-needed comment at same time
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    9800d59 View commit details
    Browse the repository at this point in the history
  28. Rename JWT refresh key to better reflect usage

    We should move it to an appropriate location and share it.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    fc07f06 View commit details
    Browse the repository at this point in the history
  29. write tests for expected org permissions. Provide custom gql config f…

    …or the orgById query.
    hahn-kev authored and rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    8a361cb View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    b10cc8f View commit details
    Browse the repository at this point in the history
  31. Implement most project and member filtering in orgById

    Still need to implement removing email addresses from members list, if
    the query asked for them without proper permission.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    72d5dd4 View commit details
    Browse the repository at this point in the history
  32. Fix incorrect unit test check

    Public projects have isConfidential *false*, not true.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    7862c73 View commit details
    Browse the repository at this point in the history
  33. Fix second incorrect test

    The "editor" user is a member of the test org; this test wants a
    non-member.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    f71e419 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    0e600ea View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    0c7c9ad View commit details
    Browse the repository at this point in the history
  36. Add new empty test project

    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    f9c0bd0 View commit details
    Browse the repository at this point in the history
  37. Make test fail with deliberate bug present in code

    This proves that the test will catch this bug.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    1439ed5 View commit details
    Browse the repository at this point in the history
  38. Remove deliberate bug, tests now pass

    This proves that the test suite is now catching the bug.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    a0a88b6 View commit details
    Browse the repository at this point in the history
  39. Allow querying username in orgById (manager only)

    Also include unit tests to prove that non-managers cannot see usernames.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    032a504 View commit details
    Browse the repository at this point in the history
  40. Query username in org page, don't use locked or emailVerified fields

    The org members table doesn't need to show the "user is locked" or
    "email not verified" icons; those can be left on the admin dashboard.
    But we do want the org managers to be able to see members' usernames,
    since there may very well be guest users in the org with usernames but
    no email addresses, and org managers should be able to help them get
    Send/Receive configuration set up properly.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    8cc5e01 View commit details
    Browse the repository at this point in the history
  41. Fix lint errors

    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    c860c72 View commit details
    Browse the repository at this point in the history
  42. Expose email/username column to org managers

    Org page show shows the email/username column to org managers/admins,
    because we have decided that they're allowed to see it and have
    implemented GraphQL rules to that effect.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    84df3f0 View commit details
    Browse the repository at this point in the history
  43. Allow org managers to view Created By for members

    Org managers, like admins, should be able to see who created a guest
    user's account. We expose this in the UserModal by adding createdBy to
    the orgMemberById query.
    rmunn committed Jul 2, 2024
    Configuration menu
    Copy the full SHA
    11647b6 View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2024

  1. Simplify OrgMemberById permission checks

    We have that logic in PermissionService now, so let's use it.
    rmunn committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    c977814 View commit details
    Browse the repository at this point in the history
  2. Simplify view logic for org projects

    We decided that people who aren't org members can still see the projects
    that they themselves are a member of, which means the rule for projects
    is the same for both members and non-members so the code gets simpler.
    rmunn committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    e2b1fcd View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a95f34f View commit details
    Browse the repository at this point in the history

Commits on Jul 4, 2024

  1. Move REFRESHED_USER_KEY to public const string

    Now there's a single source of truth for the two middleware classes that
    need to reference it.
    rmunn committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    79859a9 View commit details
    Browse the repository at this point in the history
  2. Fix failing unit tests

    The LoginAs method needs to be virtual so that it can be mocked when
    non-integration tests are running, otherwise the mock will still try to
    log in to a server that isn't there.
    rmunn committed Jul 4, 2024
    Configuration menu
    Copy the full SHA
    b62400f View commit details
    Browse the repository at this point in the history