Skip to content

Commit

Permalink
For super admin, trying update read destroy instead of manage machine…
Browse files Browse the repository at this point in the history
…conditions
  • Loading branch information
RyanTG committed Mar 21, 2021
1 parent 3d43466 commit eaf9f5f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/models/ability.rb
Expand Up @@ -13,7 +13,8 @@ def initialize(user)
can %i[update read destroy], [MachineScoreXref], location: { region_id: user.region_id }

if user.is_super_admin
can :manage, [Operator, Location, User, UserSubmission, SuggestedLocation, MachineCondition, LocationPictureXref]
can :manage, [Operator, Location, User, UserSubmission, SuggestedLocation, LocationPictureXref]
can %i[update read destroy], [MachineCondition]
else
can :manage, [Location, Operator], region_id: user.region_id
can %i[update read destroy], [SuggestedLocation], region_id: user.region_id
Expand Down
6 changes: 3 additions & 3 deletions config/initializers/rails_admin.rb
Expand Up @@ -619,7 +619,7 @@ def fetch_action_and_subject(action, abstract_model, model_object)
config.model MachineCondition do
list do
field :id, :integer
field :comment, :string
field :comment
field :user do
searchable :username
end
Expand All @@ -635,7 +635,7 @@ def fetch_action_and_subject(action, abstract_model, model_object)
end
show do
field :id, :integer
field :comment, :string
field :comment
field :user do
searchable :username
end
Expand All @@ -650,7 +650,7 @@ def fetch_action_and_subject(action, abstract_model, model_object)
field :updated_at, :date
end
edit do
field :comment, :text
field :comment
field :user do
read_only true
end
Expand Down

0 comments on commit eaf9f5f

Please sign in to comment.