stats4sd / holpa-platform

Data Platform for the HOLPA tool
0 stars 0 forks source link

Add Team Invite Feature #12

Closed dan-tang-ssd closed 2 weeks ago

dan-tang-ssd commented 3 weeks ago

This PR is submitted to fix #1

@dave-mills It is now WIP, not yet ready for review.

I submitted this PR is for progress update.


Copied team-invite feature from AEF, including below changes:

  1. migration files and seeder files for teams, team_members, team_invites, model_has_roles
  2. update User and Team model
  3. update app panel to use multi-tenancy, allow user to register new team
  4. update admin panel, only allow user with "Super Admin" role to access it
  5. copy TeamResource and UserResource
  6. install mailgun and httpclient package for sending email
  7. copy send testing email command, testing email can be sent successfully
  8. copy files required for sending team invites, including TeamInvite, InviteMember, Register, RegisterResponse, team invite email template.
  9. team-invite email can be sent successfully

WIP:

  1. when browsing the register link in team-invite email, it shows app panel login page instead of registration page...

Example registration link:

http://holpa-platform.test/register?token=XtxMoAyPpQAL4pDwXh1tKqoO&signature=d325a7885c9635cbfb75ff6270c1ff38797a49eb072f11c84f52ba81eea3c66f

Screen shot, it shows app panel login page instead of registration page: image

dan-tang-ssd commented 3 weeks ago

Up to this point, This PR can support below core features for issue #1

  1. Create a program, add new teams and/or attach existing teams to a program
  2. Attach existing user to a program
  3. After login, user can access teams directly belong to him/her + all teams of all programs belong to him/her

The remaining features of issue #1 will be developed later. I will now move to work on issue #2 first.

dan-tang-ssd commented 2 weeks ago

Hi @dave-mills

I create two branches "add-team-invite-feature" and "add-filament-odk-link" for issue #1 and #2 respectively.

For issue 2, admin panel Xlsform Template resource is working fine now. I am going to add ODK Form Management page in app panel. (I copied TeamOdkView, HelperService, XlsformResource from tape-data-system)

I realised that the changes I made in issue 1 needs to be used here for issue 2, e.g. filament multi-tenancy for User model. I need those program changes to further proceed. But it will become messy if I copy the modified program files from "add-team-invite-feature" branch to "add-filament-odk-link" branch.

In this case, should we merge two partially done PRs into dev branch, and then create new branch to continue the remaining development work?

To have the latest code from both branches to continue further development work, can I merge these two branches into a new branch "wip" first? (I created "wip" branch based on "dev" branch)

Many Thanks.

dave-mills commented 2 weeks ago

In this case, should we merge two partially done PRs into dev branch, and then create new branch to continue the remaining development work?

To have the latest code from both branches to continue further development work, can I merge these two branches into a new branch "wip" first? (I created "wip" branch based on "dev" branch)

Either sounds like a good approach. Given these PRs are merging into 'wip', lets do that 👍. Thanks!

dave-mills commented 2 weeks ago

After a quick look through, this looks good. I haven't gone into detail, but I think that's ok at this point, and we can review it together with the other PR when merging back from wip into main.

Btw - I like the 'signed' url use. Haven't seen that before, and looks like a neat approach to handling tokens for invitations.