readthedocs / ext-theme

Read the Docs drop in replacement site templates
2 stars 2 forks source link

SAML: port template #348

Closed stsewd closed 2 months ago

stsewd commented 4 months ago

This is just a basic form to show information about the integration.

Screenshot 2024-05-01 at 12-28-39 org - SAML integration - Read the Docs

Screenshot 2024-05-01 at 12-28-27 neworg - SAML integration - Read the Docs

Ref https://github.com/readthedocs/readthedocs-corporate/pull/1770

stsewd commented 4 months ago

Still have the problem from https://github.com/readthedocs/ext-theme/pull/348#discussion_r1610725000.

Screenshot 2024-05-23 at 09-50-51 org - Authorization - Read the Docs Screenshot 2024-05-23 at 09-50-44 two - Authorization - Read the Docs

agjohnson commented 3 months ago

Its fine to start with this, but I'll note that I think we need to come back to this pattern of magic links -- for this and for SSO. I don't think the user is going to know the difference between the two links, and I'm sure if we look at the data users don't use these links. If we are telling owners to invite users, they should probably use the team invite UI.

image

humitos commented 3 months ago

If we are telling owners to invite users, they should probably use the team invite UI.

Agreed. I'd say that once an organization enables SAML, the team invite UI should expose this link somehow instead of being hidden under this specific UI. Ideally, there should be only one UI to invite members and that UI should point the users to the correct place depending on what authorization method they are using.

stsewd commented 3 months ago

@agjohnson I'm having a hard time figuring out what exactly is expected here... Something like this?

Screenshot 2024-06-18 at 13-59-41 org - Authorization - Read the Docs

I really don't think we should allow changing the metadata URL yet or delete the integration without a better logic to handle "deactivation", since it's a very destructive change, it affects all users connected to that organization (and isn't easy to revert).

Also, this form isn't a model form, so fields are being manually initiated.

agjohnson commented 3 months ago

I really don't think we should allow changing the metadata URL yet or delete the integration without a better logic to handle "deactivation", since it's a very destructive change, it affects all users connected to that organization (and isn't easy to revert).

This is the new pattern I'm saying we skip. We already allow users to change, and potentially break, their project's authentication. This UI does not need to do anything different yet.

I noted this here, as well as a few places above:

Long term, I agree there is better UX we can add on these forms. But right now, all auth mechanisms, templates, and forms should use the same patterns, and currently the forms for other authentication changes warn the users as they are making changes but do not block the user from making these changes.

If your change is using a single {{ form | crispy }}, that is what all the other forms do and is correct. There should be no conditional read only rendering of a form that does not use {{ form | crispy }}. We can add warnings in later, that is not a change necessary now either.

Also, this form isn't a model form, so fields are being manually initiated.

Yup, that should be fine, as long as it is a Form instance, we should always use Crispy to display the form.

stsewd commented 3 months ago

If your change is using a single {{ form | crispy }}, that is what all the other forms do and is correct. There should be no conditional read only rendering of a form that does not use {{ form | crispy }}. We can add warnings in later, that is not a change necessary now either.

There are only two fields in that form (metadata URL and domain), the other fields are just extracted from the settings and aren't part of the Django form. Do you mean creating a form with those fields as read only and manually initiate them?

agjohnson commented 3 months ago

No, the read-only fields are okay for now as one-off, read only fields. We should eventually move this to application logic where we can though, this almost certainly doesn't need one-off template logic.

Currently, I am only talking about changing the two fields in the existing form. This form should always be displayed with {{ form | crispy }}, and should not use conditional logic to iterate over the form fields and manually display them.

stsewd commented 2 months ago

This form should always be displayed with {{ form | crispy }}, and should not use conditional logic to iterate over the form fields and manually display them.

I was already using form|crispy. I just added the update form, but it still has a conditional under to check if the integration is being created for the first time or not. And the other fields are manually displayed (since they aren't part of the form). Again, I'm not really sure if this is what you are expecting.

Screenshot 2024-07-01 at 16-20-17 new - Authorization - Read the Docs

Screenshot 2024-07-01 at 16-18-57 org - Authorization - Read the Docs

agjohnson commented 2 months ago

I was already using form|crispy

The issue was that the form was only displayed with crispy forms on creation. On update/detail view the form fields were manually generated. What you have here is close to what I was requesting.

We should track a follow up issue to fix the issues here: