Skip to content
Snippets Groups Projects
Commit 11db842f authored by pabois's avatar pabois
Browse files

adjust connections rights

parent 8ac573a7
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,7 @@ module Communication::Extranet::WithFeatures
]
end
def feature?(identifier)
def has_feature?(identifier)
public_send "feature_#{identifier}"
end
end
\ No newline at end of file
end
......@@ -9,7 +9,8 @@ module User::WithRegistrationContext
private
def extranet_access
unless registration_context.alumni.where(email: email).any?
unless (registration_context.has_feature?(:alumni) && registration_context.alumni.where(email: email).any?) ||
(registration_context.has_feature?(:contacts) && registration_context.connected_persons.where(email: email).any?)
if registration_context.registration_contact.present?
errors.add :email, I18n.t('extranet.errors.email_not_allowed_with_contact', contact: registration_context.registration_contact)
else
......
......@@ -10,7 +10,7 @@
},
]
Communication::Extranet::FEATURES.each do |feature|
next unless @extranet.feature? feature
next unless @extranet.has_feature? feature
property = "feature_#{feature}"
constant = "COMMUNICATION_EXTRANET_#{feature.upcase}"
navigation << {
......
......@@ -13,9 +13,9 @@
<%= render 'admin/communication/extranets/sidebar' do %>
<div class="row">
<% Communication::Extranet::FEATURES.each do |feature| %>
<%
<%
property = "feature_#{feature}"
active = @extranet.feature? feature
active = @extranet.has_feature? feature
next unless active
%>
<div class="col-lg-3">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment