Commit 49148843 authored by Matheus Horstmann's avatar Matheus Horstmann 🐴

Merge branch 'develop' into 'master'

Develop

See merge request !93
parents fea1022b 35908fbc
Pipeline #22708 failed with stages
in 1 minute and 28 seconds
......@@ -26,9 +26,9 @@ WORKDIR $INSTALL_PATH
COPY . .
RUN gem install rails -v 5.0.0 && \
gem install bundler && \
/app/bin/bundle install -j 4
RUN gem install bundler -v 1.16.2
RUN /app/bin/bundle install -j 4
EXPOSE 3000
VOLUME ["/app/images/citizens", "/app/images/city_halls", "/data/citizen_upload"]
......
source 'https://rubygems.org'
gem 'sprockets', '~> 3.7.1'
gem 'rake', '~> 12.3.0'
gem 'responders', '~> 2.3.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0'
......@@ -40,7 +42,7 @@ gem 'rack-attack', '~> 5.0.1'
gem 'rack-cors', '~> 0.4.1'
# Use Sidekiq for background jobs
gem 'sidekiq'
gem 'sidekiq','~> 5.0.0'
# Get Brazilian address by zipcode, directly from Correios database.
gem 'correios-cep', '~> 0.6.4'
......
......@@ -20,7 +20,7 @@ class SchedulePolicy < ApplicationPolicy
permission = Professional.get_permission(user[1])
if permission == "citizen"
return nil
return scope.where(citizen_id: citizen.id)
end
professional = citizen.professional
......@@ -29,7 +29,7 @@ class SchedulePolicy < ApplicationPolicy
city_id = service_place.city_id
city_hall_id = service_place.city_hall_id
return case permission
when "adm_c3sl"
scope.all
......@@ -52,13 +52,13 @@ class SchedulePolicy < ApplicationPolicy
end
end
def show?
citizen = user[0]
permission = Professional.get_permission(user[1])
if permission == "citizen"
return ((record.citizen_id == citizen.id) or
return ((record.citizen_id == citizen.id) or
(record.citizen.responsible_id == citizen.id))
end
......@@ -75,11 +75,11 @@ class SchedulePolicy < ApplicationPolicy
when permission == "adm_prefeitura"
return ((record.service_place.city_hall_id == service_place.city_hall_id))
when permission == "adm_local"
return ((record.service_place.id == service_place.id))
when permission == "atendendente_local"
when permission == "atendendente_local"
return ((record.service_place.id == service_place.id))
when permission == "responsavel_atendimento"
......@@ -117,7 +117,7 @@ class SchedulePolicy < ApplicationPolicy
return ((record.service_place.id == service_place.id) and
(record.situation.description == "Agendado"))
when permission == "atendendente_local"
when permission == "atendendente_local"
return ((record.service_place.id == service_place.id) and
(record.situation.description == "Agendado"))
......@@ -137,7 +137,7 @@ class SchedulePolicy < ApplicationPolicy
# TODO: Check for permissions between schedule and citizen being scheduled.
# It involves either the future relation between schedule and citizen or
# It involves either the future relation between schedule and citizen or
# simply the location related to the shift which the schedule is related to.
# (record.shift.service_place.city_id)
#
......@@ -157,7 +157,7 @@ class SchedulePolicy < ApplicationPolicy
if permission == "citizen"
dependants_ids = Citizen.where(responsible_id: citizen.id).pluck(:id)
# Return false if the target is neither the current citizen nor one
# Return false if the target is neither the current citizen nor one
# of his dependants
return (schedulee.id == citizen.id or (dependants_ids.include?(schedulee.id)))
end
......
......@@ -8,6 +8,10 @@ pt-BR:
has_one: Não é possível excluir o registro pois existe um %{record} dependente
has_many: Não é possível excluir o registro pois existem %{record} dependentes
models:
account:
attributes:
encrypted_password:
blank: "Campo senha não pode ficar em branco!"
citizen:
attributes:
address_number:
......@@ -18,7 +22,7 @@ pt-BR:
blank: "Campo data de nascimento não pode ficar em branco"
cpf:
blank: "Campo CPF não pode ficar em branco"
taken: "CPF está em uso"
taken: "CPF está em uso!"
name:
blank: "Campo nome não pode ficar em branco"
city_hall:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment