-
Notifications
You must be signed in to change notification settings - Fork 4
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
Permettre aux agents de se créer un compte sans organisation via Proconnect #5102
Changes from all commits
f975c3e
5160b36
ad9d527
19bc8db
cc1fef8
2683f3b
786cede
9a196f2
ee42836
0c50e6b
74ccc50
292efdb
f068c33
5fa24af
68447ea
10c127a
e23a814
68e0b7c
d832295
d1670ed
cc0c1e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class Agents::PagesController < AgentAuthController | ||
layout "application" | ||
|
||
CONTACT_TEAM_URL = "https://cal.com/forms/937585aa-48a4-4efd-a642-961fad79c9c5".freeze | ||
|
||
def home | ||
skip_authorization | ||
|
||
accessible_organisations = policy_scope(Organisation, policy_scope_class: Agent::OrganisationPolicy::Scope) | ||
|
||
if accessible_organisations.count == 1 | ||
redirect_to admin_organisation_agent_agenda_path(accessible_organisations.first, current_agent) | ||
elsif accessible_organisations.count > 1 | ||
redirect_to admin_organisations_path | ||
end | ||
end | ||
|
||
private | ||
|
||
def pundit_user | ||
AgentContext.new(current_agent) | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,3 +107,7 @@ select { | |
outline-offset: $focus-outline-offset; | ||
} | ||
} | ||
|
||
.form-group { | ||
margin: 8px 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
:support_email, | ||
:secretariat_email, | ||
:verticale, | ||
:allow_agent_creation_with_agent_connect, | ||
keyword_init: true | ||
) | ||
|
||
|
@@ -36,6 +37,7 @@ class Domain | |
france_connect_enabled: true, | ||
support_email: "[email protected]", | ||
verticale: :rdv_solidarites, | ||
allow_agent_creation_with_agent_connect: false, | ||
secretariat_email: "[email protected]" | ||
# secretariat_email est utilisé comme adresse de "Reply-To" pour les e-mails | ||
# qui contiennent des ICS. Lorsque l'événement ICS est acceptée par le | ||
|
@@ -58,6 +60,7 @@ class Domain | |
france_connect_enabled: false, | ||
support_email: "[email protected]", | ||
verticale: :rdv_aide_numerique, | ||
allow_agent_creation_with_agent_connect: false, | ||
secretariat_email: "[email protected]" | ||
), | ||
|
||
|
@@ -76,6 +79,7 @@ class Domain | |
france_connect_enabled: true, | ||
support_email: "[email protected]", | ||
verticale: :rdv_mairie, | ||
allow_agent_creation_with_agent_connect: true, | ||
secretariat_email: "[email protected]" | ||
), | ||
].freeze | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,9 @@ def call | |
@agent = find_agent | ||
|
||
if @agent | ||
if @agent.services.none? | ||
@agent.update(service_ids: @agent_params[:service_ids]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Et si dans Disons que là je vois qu'on utilise des |
||
end | ||
add_agent_to_organisations | ||
@warning_message = self.class.check_agent_service(@agent, @agent_params[:service_ids]) | ||
elsif @access_level == "intervenant" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.fr-container.fr-pb-8w | ||
h1.fr-h3.fr-pb-2w Bienvenue ! | ||
p.fr-py-1w Pour commencer, aidez-nous à en savoir plus : | ||
|
||
p.fr-pt-1w.fr-pb-2w | ||
| Votre structure <b>utilise déjà #{current_domain.name}</b> et vous souhaitez disposer d’un accès ? | ||
br | ||
| Vos collègues peuvent vous inviter depuis le menu <b>“Paramètres > Agents > Ajouter un agent”</b>. | ||
|
||
p.fr-py-1w | ||
| Votre structure <b>n’utilise pas #{current_domain.name}</b> et vous souhaitez créer un compte ? | ||
br | ||
| Nous vous invitons à contacter notre équipe. Nous organiserons un temps d’échanges pour vous présenter la solution et créer le compte de votre structure. | ||
|
||
ul.fr-btns-group.fr-btns-group--center.fr-btns-group--inline-md.fr-mb-8w | ||
li | ||
= link_to "Contacter notre équipe", "https://cal.com/team/rdv-service-public/temps-d-echanges", class: "fr-btn" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,11 @@ header.main-content__header role="banner" | |
=> link_to "Inviter", invite_super_admins_agent_path(page.resource), method: :post, class: "button", data: { disable_with: "Veuillez patienter…"} if accessible_action?(page.resource, :invite) | ||
- if sign_in_as_allowed? | ||
=> link_to "Se logger en tant que", sign_in_as_super_admins_agent_path(page.resource), class: "button" if accessible_action?(page.resource, :sign_in_as) | ||
=> link_to(t("administrate.actions.edit_resource", name: page.page_title), [:edit, namespace, page.resource], class: "button") if accessible_action?(page.resource, :edit) | ||
=> link_to("Modifier", [:edit, namespace, page.resource], class: "button") if accessible_action?(page.resource, :edit) | ||
=> link_to("Migrer", new_super_admins_agent_migration_path(agent_id: page.resource.id), class: "button") | ||
- if page.resource.roles.none? | ||
= link_to("Ouvrir un compte", new_super_admins_compte_path(agent_id: page.resource.id), class: "button") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trop malin ! 🤩 |
||
|
||
section.main-content__body | ||
dl | ||
- page.attributes.each do |attribute| | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,7 +290,7 @@ | |
end | ||
end | ||
authenticated :agent do | ||
root to: "admin/organisations#index", as: :authenticated_agent_root, defaults: { follow_unique: "1" } | ||
root to: "agents/pages#home", as: :authenticated_agent_root | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Beaucoup plus compréhensible et simple ! |
||
end | ||
|
||
scope path: "prescripteur", as: "prescripteur", controller: "prescripteur_rdv_wizard" do | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,3 +49,18 @@ | |
|
||
user.skip_confirmation! | ||
user.save! | ||
|
||
# Un agent pour tester l'absence d'orga et de services | ||
agent = Agent.new( | ||
email: "[email protected]", | ||
uid: "[email protected]", | ||
first_name: "Bob", | ||
last_name: "Sans Organisation", | ||
password: "Rdvservicepublictest1!", | ||
services: [], | ||
invitation_accepted_at: 1.day.ago, | ||
roles_attributes: [], | ||
agent_territorial_access_rights_attributes: [] | ||
) | ||
agent.skip_confirmation! | ||
agent.save! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
RSpec.describe AdminCreatesAgent do | ||
context "when inviting an agent that doesn't have any services" do | ||
let(:agent) do | ||
create(:agent, :no_services, organisations: []) | ||
end | ||
let(:service1) { create(:service) } | ||
let(:service2) { create(:service) } | ||
let(:organisation) do | ||
create(:organisation) | ||
end | ||
let(:admin) do | ||
create(:agent, admin_role_in_organisations: [organisation]) | ||
end | ||
|
||
it "adds the services to the agent" do | ||
described_class.new( | ||
agent_params: { email: agent.email, service_ids: [service1.id, service2.id] }, | ||
current_agent: admin, | ||
organisations: [organisation], | ||
access_level: :basic | ||
).call | ||
|
||
expect(agent.reload.services).to contain_exactly(service1, service2) | ||
expect(agent.organisations).to eq [organisation] | ||
end | ||
end | ||
end |
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.
Je prédit que l'omelette ne se fera pas sans casser des œufs, mais moi aussi j'ai faim ! 😉