-
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
User Credential Views #323
Conversation
if users: | ||
add_connect_users.delay(users, form.instance.id) | ||
filter_country = form.cleaned_data["filter_country"] | ||
filter_credential = form.cleaned_data["filter_credential"] |
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.
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.
Yes, we only offer a choice on the select and do not let the user enter custom data.
@@ -25,10 +28,19 @@ def organization_home(request, org_slug): | |||
if not form: | |||
form = OrganizationChangeForm(instance=org) | |||
|
|||
credentials = connect_id_client.fetch_credentials() | |||
if not len(list(c for c in credentials if c.name == f"Worked for {org.name}")): |
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.
if not len(list(c for c in credentials if c.name == f"Worked for {org.name}")): | |
if not any(c.name == f"Worked for {org.name}" for c in credentials): |
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.
Added. f309779 Thanks
def add_credential_view(request, org_slug): | ||
org = get_object_or_404(Organization, slug=org_slug) | ||
credentials = connect_id_client.fetch_credentials() | ||
if not len(list(c for c in credentials if c.name == f"Worked for {org.name}")): |
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.
if not len(list(c for c in credentials if c.name == f"Worked for {org.name}")): | |
if not any(c.name == f"Worked for {org.name}" for c in credentials): |
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.
Added. f309779
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.
A couple small questions but seems mostly good once the merge conflicts are fixed.
@@ -25,10 +28,19 @@ def organization_home(request, org_slug): | |||
if not form: | |||
form = OrganizationChangeForm(instance=org) | |||
|
|||
credentials = connect_id_client.fetch_credentials() | |||
if not any(c.name == f"Worked for {org.name}" for c in credentials): | |||
credentials.append(Credential(name=f"Worked for {org.name}", slug="default")) |
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.
what does it mean that slug is always default here?
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 is here in case there are no credentials present in the database. If a credential with the same name is present the default credential is not added to the list.
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.
Is a credential added to the DB with a slug default
ever or sent to connectid?
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.
Nope, we only send the name of the credential that is to be added. The slugs are generated in ConnectID from the credential names.
org = get_object_or_404(Organization, slug=org_slug) | ||
credentials = connect_id_client.fetch_credentials() | ||
if not any(c.name == f"Worked for {org.name}" for c in credentials): | ||
credentials.append(Credential(name=f"Worked for {org.name}", slug=f"Worked for {org.name}")) |
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.
why does the slug differ between the two places this occurs?
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.
Additionally, slugs should be an actual slug not normal text (lowercased, underscore separated, etc).
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.
Fixed. 9aa3e50
Ticket
Filter by Country and Credential, and Add Users:
Add Credential to Users: