Skip to content

Commit

Permalink
use role_member with provider. datacite/bracco#195
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed May 24, 2019
1 parent 576d23f commit 89e8b00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/controllers/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def index
elsif params[:ids].present?
response = Provider.find_by_id(params[:ids], page: page, sort: sort)
else
response = Provider.query(params[:query], year: params[:year], region: params[:region], organization_type: params[:organization_type], focus_area: params[:focus_area], page: page, sort: sort)
response = Provider.query(params[:query], year: params[:year], region: params[:region], organization_type: params[:organization_type], focus_area: params[:focus_area], all_members: params[:all_members], page: page, sort: sort)
end

begin
Expand Down Expand Up @@ -221,7 +221,7 @@ def destroy

# Use callbacks to share common setup or constraints between actions.
def set_provider
@provider = Provider.unscoped.where("allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM_LEAD' , 'ROLE_ALLOCATOR', 'ROLE_ADMIN')").where(deleted_at: nil).where(symbol: params[:id]).first
@provider = Provider.unscoped.where("allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM_LEAD' , 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER')").where(deleted_at: nil).where(symbol: params[:id]).first
fail ActiveRecord::RecordNotFound unless @provider.present?
end

Expand All @@ -244,7 +244,7 @@ def safe_params
"votingContact",{ "votingContact": [:email, "givenName", "familyName"]}
],
keys: {
"organizationType" => :organization_type, "focusArea" => :focus_area, "contactName" => :contact_name, "contactEmail" => :contact_email, :country => :country_code, "isActive" => :is_active, "passwordInput" => :password_input, "billingInformation" => :billing_information , "postCode" => :post_code, "rorId" => :ror_id, "twitterHandle" =>:twitter_handle, "roleName" =>:role_name,
"organizationType" => :organization_type, "focusArea" => :focus_area, "contactName" => :contact_name, "contactEmail" => :contact_email, :country => :country_code, "isActive" => :is_active, "passwordInput" => :password_input, "billingInformation" => :billing_information , "postCode" => :post_code, "rorId" => :ror_id, "twitterHandle" => :twitter_handle, "roleName" => :role_name,
"technicalContact" => :technical_contact,
"secondaryBillingContact" => :secondary_billing_contact,
"billingContact" => :billing_contact,
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/provider_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class ProviderSerializer
set_id :uid
# cache_options enabled: true, cache_length: 24.hours ### we cannot filter if we cache

attributes :name, :symbol, :website, :contact_name, :contact_email, :phone, :description, :region, :country, :logo_url, :organization_type, :focus_area, :is_active, :has_password, :joined, :twitter_handle, :billing_information, :ror_id, :technical_contact,:billing_contact, :secondary_billing_contact, :service_contact, :voting_contact, :created, :updated
attributes :name, :symbol, :website, :contact_name, :contact_email, :phone, :description, :region, :country, :logo_url, :member_type, :organization_type, :focus_area, :is_active, :has_password, :joined, :twitter_handle, :billing_information, :ror_id, :technical_contact, :billing_contact, :secondary_billing_contact, :service_contact, :voting_contact, :created, :updated

has_many :clients, record_type: :clients
has_many :prefixes, record_type: :prefixes
Expand Down

0 comments on commit 89e8b00

Please sign in to comment.