-
Notifications
You must be signed in to change notification settings - Fork 0
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
addProgramUser
mutation
#1500
addProgramUser
mutation
#1500
Conversation
def addProgramUser( | ||
sso: SsoGraphQlClient[F], | ||
input: AddProgramUserInput | ||
)(using NoTransaction[F]): F[Result[(Program.Id, User.Id)]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this was just moved from ProgramService
in order to group everything ProgramUser
related. This mutation though, addProgramUser
, is new.
): Option[AppliedFragment] = | ||
user.role match | ||
case GuestRole => existsUserAsPi(programId, user.id).some | ||
case StandardRole.Pi(_) => (void"(" |+| existsUserAsPi(programId, user.id) |+| void" OR " |+| existsUserAsCoi(programId, user.id) |+| void")").some |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think perhaps we may want to say that a CoI only has access if they have accepted an invitation? At any rate, at the moment they will have access immediately if added via addProgramUser
.
@@ -141,7 +141,7 @@ object UserInvitationService: | |||
val xa = transaction | |||
xa.savepoint.flatMap: sp => | |||
session | |||
.prepareR(ProgramService.Statements.LinkUser.command) | |||
.prepareR(ProgramUserService.Statements.LinkUser.command) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here in the UserInvitationService
when a user accepts an invitation, we attempt to "link" them to the program (i.e., add them as a ProgramUser
). If previously added explicitly via addProgramUser
then the linking part will fail with a warning -- though this doesn't fail the invitation redemption as a whole. I think we'll want to handle this more smoothly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. Can you add stories for the potential issues you identified in your comments? 👍
That's a good idea: https://app.shortcut.com/lucuma/story/4141/handle-invitations-for-direct-program-users https://app.shortcut.com/lucuma/story/4144/program-access-for-pre-acceptance-users |
This PR:
UserProfile
and refactoring ofOrcidProfile
from corefallback
profile inProgramUser
which provides a location for name and email when not specified in the public ORCiD dataProgramUser
parts of theProgramService
into a newProgramUserService
addProgramUser
mutationThe purpose of the mutation is to allow CoIs to be created and linked even before they have been extended / have accepted an invitation. There is additional work to do here, I believe, to support the UI suggested in ShortCut 3774. In particular there is no clear link between invitations and program users. This will be addressed in a future PR but I think for now this will keep the invitation system working as is.